hopefully fix something in CreateClassKey

svn path=/trunk/; revision=16415
This commit is contained in:
Gunnar Dalsnes 2005-07-04 21:54:36 +00:00
parent 199b9bce22
commit d8e78cc66b

View file

@ -20,7 +20,7 @@
#include "config.h" #include "config.h"
#include "wine/port.h" #include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
@ -1302,30 +1302,26 @@ static HKEY CreateClassKey(HINF hInf)
MAX_PATH - 1, MAX_PATH - 1,
&RequiredSize)) &RequiredSize))
{ {
return INVALID_HANDLE_VALUE; return INVALID_HANDLE_VALUE;
} }
lstrcpyW(FullBuffer, ControlClass); lstrcpyW(FullBuffer, ControlClass);
lstrcatW(FullBuffer, Buffer); lstrcatW(FullBuffer, Buffer);
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
FullBuffer, if (!SetupGetLineTextW(NULL,
0,
KEY_ALL_ACCESS,
&hClassKey))
{
if (!SetupGetLineTextW(NULL,
hInf, hInf,
Version, Version,
Class, Class,
Buffer, Buffer,
MAX_PATH, MAX_PATH,
&RequiredSize)) &RequiredSize))
{ {
return INVALID_HANDLE_VALUE; RegDeleteKeyW(HKEY_LOCAL_MACHINE, FullBuffer);
} return INVALID_HANDLE_VALUE;
}
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, if (ERROR_SUCCESS != RegCreateKeyExW(HKEY_LOCAL_MACHINE,
FullBuffer, FullBuffer,
0, 0,
NULL, NULL,
@ -1333,24 +1329,22 @@ static HKEY CreateClassKey(HINF hInf)
KEY_ALL_ACCESS, KEY_ALL_ACCESS,
NULL, NULL,
&hClassKey, &hClassKey,
NULL)) NULL))
{ {
return INVALID_HANDLE_VALUE; RegDeleteKeyW(HKEY_LOCAL_MACHINE, FullBuffer);
} return INVALID_HANDLE_VALUE;
} }
if (RegSetValueExW(hClassKey, if (ERROR_SUCCESS != RegSetValueExW(hClassKey,
Class, Class,
0, 0,
REG_SZ, REG_SZ,
(LPBYTE)Buffer, (LPBYTE)Buffer,
RequiredSize * sizeof(WCHAR))) RequiredSize * sizeof(WCHAR)))
{ {
RegCloseKey(hClassKey); RegCloseKey(hClassKey);
RegDeleteKeyW(HKEY_LOCAL_MACHINE, RegDeleteKeyW(HKEY_LOCAL_MACHINE, FullBuffer);
FullBuffer); return INVALID_HANDLE_VALUE;
return INVALID_HANDLE_VALUE;
} }
return hClassKey; return hClassKey;
@ -1397,6 +1391,7 @@ BOOL WINAPI SetupDiInstallClassW(
SetupCloseInfFile(hInf); SetupCloseInfFile(hInf);
return FALSE; return FALSE;
} }
RegCloseKey(hClassKey);
/* Try to append a layout file */ /* Try to append a layout file */