Click here to Skip to main content
15,918,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralUnderstanding HEAP: Free Heap block errors Pin
Jim Crafton6-Sep-03 7:34
Jim Crafton6-Sep-03 7:34 
GeneralRe: Understanding HEAP: Free Heap block errors Pin
Rama Krishna Vavilala6-Sep-03 11:05
Rama Krishna Vavilala6-Sep-03 11:05 
GeneralRe: Understanding HEAP: Free Heap block errors Pin
Jim Crafton6-Sep-03 11:08
Jim Crafton6-Sep-03 11:08 
QuestionFastest Text api? Pin
Roggan6-Sep-03 7:18
Roggan6-Sep-03 7:18 
GeneralSendMessage() Pin
lpRomang6-Sep-03 5:44
lpRomang6-Sep-03 5:44 
GeneralRe: SendMessage() Pin
Michael Dunn6-Sep-03 5:58
sitebuilderMichael Dunn6-Sep-03 5:58 
QuestionCView in DLL, CDocument in EXE :: How to share? Pin
clintsinger6-Sep-03 5:40
clintsinger6-Sep-03 5:40 
QuestionRegDeleteValue with REG_MULTI_SX/MoveFileEx? Pin
Kayembi6-Sep-03 5:16
Kayembi6-Sep-03 5:16 
Hi,

I'm using MoveFileEx with MOVEFILE_DELAY_UNTIL_REBOOT to delete some temporary files if the user reboots the PC whilst using my program (XP/2000/NT - I'm using WinInit.INI for other systems). However, if the program closes normally, I need to cancel the MOVEFILE_DELAY_UNTIL_REBOOT for all the temporary files that it has been set for.

According to MSDN, MoveFileEx "stores the locations of the files to be renamed at restart in the following registry value:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations

This registry value is of type REG_MULTI_SZ. Each rename operation stores the following pair of NULL-terminated strings:

szDstFile\0\0
szSrcFile\0szDstFile\0\0"

I checked the registry using regedit, and found all the values there as specified, and discovered that, say if the file to be deleted is "c:\\test\test.exe", then it would be listed in the registry as:

\??\c:\\test\test.exe

Thus, to cancel all of registry entries, I tried this:

[code]
HKEY hKey;
char szRegKey[MAX_PATH];

RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\PendingFileRenameOperations",
0,KEY_ALL_ACCESS,&hKey);

//this part should be looped for each file to be deleted:
strcpy(szRegKey,"\\??\\");
strcat(szRegKey,szFileToDelete);
RegDeleteValue(hKey,szRegKey);

RegCloseKey(hKey);
[/code]

However, this didn't work - all the entries in the registry were left just as they were.

Could anybody tell me where I am going wrong, and how to correct this so that I can delete all of the registry values that were added by MoveFileEx?

Any help much appreciated,
Many thanks,
KB
AnswerRe: RegDeleteValue with REG_MULTI_SX/MoveFileEx? Pin
Kayembi7-Sep-03 2:35
Kayembi7-Sep-03 2:35 
GeneralRe: RegDeleteValue with REG_MULTI_SX/MoveFileEx? Pin
Kayembi7-Sep-03 3:49
Kayembi7-Sep-03 3:49 
GeneralSet the Bk color of a list ctrl Pin
Md Saleem Navalur6-Sep-03 3:07
Md Saleem Navalur6-Sep-03 3:07 
GeneralRe: Set the Bk color of a list ctrl Pin
valikac6-Sep-03 5:07
valikac6-Sep-03 5:07 
GeneralRe: Set the Bk color of a list ctrl Pin
Michael Dunn6-Sep-03 6:05
sitebuilderMichael Dunn6-Sep-03 6:05 
GeneralRe: Set the Bk color of a list ctrl Pin
Jörgen Sigvardsson6-Sep-03 11:33
Jörgen Sigvardsson6-Sep-03 11:33 
GeneralRe: Set the Bk color of a list ctrl Pin
Anthony_Yio7-Sep-03 0:24
Anthony_Yio7-Sep-03 0:24 
QuestionBringing a window to the top? Pin
Dov Sherman5-Sep-03 18:18
Dov Sherman5-Sep-03 18:18 
AnswerRe: Bringing a window to the top? Pin
Michael Dunn5-Sep-03 18:50
sitebuilderMichael Dunn5-Sep-03 18:50 
AnswerRe: Bringing a window to the top? Pin
Neville Franks5-Sep-03 23:26
Neville Franks5-Sep-03 23:26 
QuestionThe best way 2 skin an application? Pin
Roland19805-Sep-03 12:03
sussRoland19805-Sep-03 12:03 
AnswerRe: The best way 2 skin an application? Pin
Phil Speller5-Sep-03 12:50
Phil Speller5-Sep-03 12:50 
Questionhow to get the number of digits Pin
elmahdy5-Sep-03 11:50
elmahdy5-Sep-03 11:50 
AnswerRe: how to get the number of digits Pin
Shog95-Sep-03 12:26
sitebuilderShog95-Sep-03 12:26 
AnswerRe: how to get the number of digits Pin
David Crow5-Sep-03 15:00
David Crow5-Sep-03 15:00 
AnswerRe: how to get the number of digits Pin
Terry O'Nolley5-Sep-03 18:25
Terry O'Nolley5-Sep-03 18:25 
AnswerRe: how to get the number of digits Pin
Ted Ferenc6-Sep-03 9:50
Ted Ferenc6-Sep-03 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.