Hey all! I am trying to write a piece of code that will replace one of my system files on reboot with a new version of that file. Hopefully someone out there has some experience with this as I am stumped at the moment.
Using: VB.NET 2012
Public Declare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal dwFlags As Integer) As Integer Public Const MOVEFILE_DELAY_UNTIL_REBOOT = 4
Code in Form
MoveFileEx("C:\windows\system32\file.name", My.Application.Info.DirectoryPath + "\file.name", 4)
Resource for this API call at MSDS: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx
Im using flag code 4, which is MOVEFILE_DELAY_UNTIL_REBOOT. I have also tried flag code 5 which is MOVEFILE_DELAY_UNTIL_REBOOT and MOVEFILE_REPLACE_EXISTING to no success.
If anyone can shed some light on this, the help would be very much appreciated.
Thank you in advance :)