Alex Ionescu schrieb:
James Tabor wrote:
BugCheck Alert!
Hmm...looks like after reverting Thomas's patch and using Hartmut's, the problems are happening again. So, it would seem that Thomas' patch is more correct? Or perhaps both should be used? T/H: Let me know!
Hi,
I've written a little test program which does always crash ros with my patch on the smp machine (up not tested). The program does create 10 threads which try to open a non existing registry key in an endless loop. It does not crash with Thomas' patch. His patch adds one reference to much to the first parsed/opened key. This makes it impossible to delete a key and to unload the registry at shut down. I think we have a problem outside from the registry. It seems there is a gap between the deleting of an object after the last dereference operation and the next create operation for a new object with the same name. One thread has reopend the object and use it and the other delete the same object. I see very often values of 0xcccccxxx on bug checks and the wrong reference value -858993460 is also 0xcccccccc.
- Hartmut
#include <stdlib.h> #include <stdio.h> #include <process.h> #include <windows.h>
ULONG Count = 0; volatile ULONG Terminate = 0;
DWORD WINAPI RegTest(LPVOID param) { HKEY hKey; LONG Result;
while(!Terminate) { #if 0 Result = RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion\SysFontSubstitutes", &hKey); if (Result == ERROR_SUCCESS) { InterlockedIncrement(&Count); RegCloseKey(hKey); } #endif Result = RegOpenKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows NT\CurrentVersion\FontSubstitutes", &hKey); if (Result == ERROR_SUCCESS) { InterlockedIncrement(&Count); RegCloseKey(hKey); } } return 0; }
int main(int argc, char* argv[]) { int i;
printf("RegTest\n");
for (i = 0; i < 10; i++) { CreateThread(NULL, 0, RegTest, NULL, 0, NULL); }
Sleep(5000);
Terminate = 1;
Sleep(200);
printf("Done (%ld)\n", Count);
return 0;
}