Sign in to follow this  
Followers 0
bluebearr

DllCall problem: MoveFileExA

5 posts in this topic

I'm trying to make a call to MoveFileExA to delete an inuse file on reboot. Here is my code:

$delfile = ""
$MOVEFILE_DELAY_UNTIL_REBOOT = 4
$result = DllCall("kernel32.dll", "short", "MoveFileExA", "str", "C:\temp\Test.txt", "str", $delfile, "int", $MOVEFILE_DELAY_UNTIL_REBOOT)

If I set $delfile to a string (like 'C:\temp\Test2.txt'), the HKLM\SYSTEM\CurrentControlSet\Control\Session Manager key gets updated as desired. However, I can't figure out how to pass a NULL to the function. I've tried an empty string, Chr(0), and a dimensioned but empty variable. None of these worked.

BTW, I'm aware that I can edit the registry value directly, but I've run into problems with this in the past with other tools (*cough* VBScript *cough*), so I would like to use the API call if possible.

Any ideas? Thanks!


BlueBearrOddly enough, this is what I do for fun.

Share this post


Link to post
Share on other sites



Try 0 or Default, however I'm unsure.


My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

prt and 0 worked like a charm!

Now why couldn't I find that? Grrr...

Thanks for the help!!!


BlueBearrOddly enough, this is what I do for fun.

Share this post


Link to post
Share on other sites

For future reference ->

Search->More Search Options->"Search titles only"->+dllcall +null->Perform the Search

Been said before and I'll say it agian-

80% of all questions asked here can be solved by the same method or doing a appopriate google search.

That is to say you can know next to nothing but if you know how to 'search' you can look smart :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0