Author: hpoussin Date: Thu May 24 01:40:46 2007 New Revision: 26876
URL: http://svn.reactos.org/svn/reactos?rev=26876&view=rev Log: Specify W suffix when possible Don't allocate unneeded memory in SetupDiCreateDeviceInfoListExW Replace strings by array of WCHARs
Modified: trunk/reactos/dll/win32/setupapi/devclass.c trunk/reactos/dll/win32/setupapi/devinst.c trunk/reactos/dll/win32/setupapi/driver.c trunk/reactos/dll/win32/setupapi/install.c trunk/reactos/dll/win32/setupapi/misc.c trunk/reactos/dll/win32/setupapi/parser.c trunk/reactos/dll/win32/setupapi/queue.c
Modified: trunk/reactos/dll/win32/setupapi/devclass.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devclass... ============================================================================== --- trunk/reactos/dll/win32/setupapi/devclass.c (original) +++ trunk/reactos/dll/win32/setupapi/devclass.c Thu May 24 01:40:46 2007 @@ -30,6 +30,7 @@ static const WCHAR ClassInstall32[] = {'C','l','a','s','s','I','n','s','t','a','l','l','3','2',0}; static const WCHAR DotServices[] = {'.','S','e','r','v','i','c','e','s',0}; static const WCHAR InterfaceInstall32[] = {'I','n','t','e','r','f','a','c','e','I','n','s','t','a','l','l','3','2',0}; +static const WCHAR SetupapiDll[] = {'s','e','t','u','p','a','p','i','.','d','l','l',0}; static const WCHAR Version[] = {'V','e','r','s','i','o','n',0};
typedef BOOL @@ -633,7 +634,7 @@ if (RequiredSize) *RequiredSize = dwLength / sizeof(WCHAR) + 1;
- if (ClassNameSize * sizeof(WCHAR) >= dwLength + sizeof(UNICODE_STRING)) + if (ClassNameSize * sizeof(WCHAR) >= dwLength + sizeof(UNICODE_NULL)) { if (ClassNameSize > sizeof(UNICODE_NULL)) ClassName[ClassNameSize / sizeof(WCHAR)] = UNICODE_NULL; @@ -835,7 +836,7 @@ if (RequiredSize) *RequiredSize = dwLength / sizeof(WCHAR) + 1;
- if (ClassDescriptionSize * sizeof(WCHAR) >= dwLength + sizeof(UNICODE_STRING)) + if (ClassDescriptionSize * sizeof(WCHAR) >= dwLength + sizeof(UNICODE_NULL)) { if (ClassDescriptionSize > sizeof(UNICODE_NULL)) ClassDescription[ClassDescriptionSize / sizeof(WCHAR)] = UNICODE_NULL; @@ -1597,7 +1598,7 @@ else { /* Look up icon in setupapi.dll */ - DllName = L"setupapi.dll"; + DllName = SetupapiDll; iconIndex = -iconIndex; }
Modified: trunk/reactos/dll/win32/setupapi/devinst.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devinst.... ============================================================================== --- trunk/reactos/dll/win32/setupapi/devinst.c (original) +++ trunk/reactos/dll/win32/setupapi/devinst.c Thu May 24 01:40:46 2007 @@ -27,10 +27,13 @@ static const WCHAR BackSlash[] = {'\',0}; static const WCHAR ClassGUID[] = {'C','l','a','s','s','G','U','I','D',0}; static const WCHAR Class[] = {'C','l','a','s','s',0}; +static const WCHAR DateFormat[] = {'%','u','-','%','u','-','%','u',0}; static const WCHAR DotCoInstallers[] = {'.','C','o','I','n','s','t','a','l','l','e','r','s',0}; static const WCHAR DotHW[] = {'.','H','W',0}; static const WCHAR DotServices[] = {'.','S','e','r','v','i','c','e','s',0}; static const WCHAR InfDirectory[] = {'i','n','f','\',0}; +static const WCHAR InstanceKeyFormat[] = {'%','0','4','l','u',0}; +static const WCHAR VersionFormat[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
static const WCHAR REGSTR_DRIVER_DATE[] = {'D','r','i','v','e','r','D','a','t','e',0}; static const WCHAR REGSTR_DRIVER_DATE_DATA[] = {'D','r','i','v','e','r','D','a','t','e','D','a','t','a',0}; @@ -170,7 +173,6 @@ IN PVOID Reserved) { struct DeviceInfoSet *list; - LPWSTR UNCServerName = NULL; DWORD size; DWORD rc; CONFIGRET cr; @@ -206,15 +208,7 @@ SetLastError(rc); goto cleanup; } - UNCServerName = MyMalloc((strlenW(MachineName) + 3) * sizeof(WCHAR)); - if (!UNCServerName) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto cleanup; - } - - UNCServerName[0] = UNCServerName[1] = '\'; - strcpyW(UNCServerName + 2, MachineName); + list->szData[0] = list->szData[1] = '\'; strcpyW(list->szData + 2, MachineName); list->MachineName = list->szData; @@ -224,7 +218,7 @@ list->HKLM = HKEY_LOCAL_MACHINE; list->MachineName = NULL; } - cr = CM_Connect_MachineW(UNCServerName, &list->hMachine); + cr = CM_Connect_MachineW(list->MachineName, &list->hMachine); if (cr != CR_SUCCESS) { SetLastError(GetErrorCodeFromCrCode(cr)); @@ -245,7 +239,6 @@ MyFree(list); } } - MyFree(UNCServerName); return ret; }
@@ -733,7 +726,7 @@ OSVERSIONINFOEX VersionInfo; SYSTEM_INFO SystemInfo; VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - ret = GetVersionEx((POSVERSIONINFO)&VersionInfo); + ret = GetVersionExW((OSVERSIONINFO*)&VersionInfo); if (!ret) goto done; GetSystemInfo(&SystemInfo); @@ -1540,7 +1533,7 @@ } if (CanHandle & CLASS_COINSTALLER) { - rc = RegOpenKeyEx( + rc = RegOpenKeyExW( HKEY_LOCAL_MACHINE, REGSTR_PATH_CODEVICEINSTALLERS, 0, /* Options */ @@ -2139,7 +2132,7 @@ else { WCHAR subKey[5]; - snprintfW(subKey, 4, L"%04lu", HwProfile); + snprintfW(subKey, 4, InstanceKeyFormat, HwProfile); subKey[4] = '\0'; rc = RegOpenKeyExW( hHWProfilesKey, @@ -2266,7 +2259,7 @@ if (UuidToStringW((UUID*)&DeviceInfoData->ClassGuid, &lpGuidString) != RPC_S_OK) goto cleanup; /* The driver key is in \System\CurrentControlSet\Control\Class{GUID}\Index */ - DriverKey = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpGuidString) + 7) * sizeof(WCHAR) + sizeof(UNICODE_STRING)); + DriverKey = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpGuidString) + 7) * sizeof(WCHAR) + sizeof(UNICODE_NULL)); if (!DriverKey) { SetLastError(ERROR_NOT_ENOUGH_MEMORY); @@ -2274,8 +2267,9 @@ } DriverKey[0] = '{'; strcpyW(&DriverKey[1], lpGuidString); - strcatW(DriverKey, L"}\"); pDeviceInstance = &DriverKey[strlenW(DriverKey)]; + *pDeviceInstance++ = '}'; + *pDeviceInstance++ = '\'; rc = RegOpenKeyExW(RootKey, REGSTR_PATH_CLASS_NT, 0, @@ -2292,8 +2286,8 @@ while (Index <= 9999) { DWORD Disposition; - wsprintf(pDeviceInstance, L"%04lu", Index); - rc = RegCreateKeyEx(hClassKey, + sprintfW(pDeviceInstance, InstanceKeyFormat, Index); + rc = RegCreateKeyExW(hClassKey, DriverKey, 0, NULL, @@ -2328,7 +2322,7 @@ hDeviceKey = SetupDiOpenDevRegKey(DeviceInfoSet, DeviceInfoData, Scope, HwProfile, DIREG_DEV, KEY_SET_VALUE); if (hDeviceKey == INVALID_HANDLE_VALUE) goto cleanup; - rc = RegSetValueEx(hDeviceKey, REGSTR_VAL_DRIVER, 0, REG_SZ, (const BYTE *)DriverKey, (strlenW(DriverKey) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hDeviceKey, REGSTR_VAL_DRIVER, 0, REG_SZ, (const BYTE *)DriverKey, (strlenW(DriverKey) + 1) * sizeof(WCHAR)); if (rc != ERROR_SUCCESS) { SetLastError(rc); @@ -2883,7 +2877,7 @@
/* Return the current hardware profile id, or -1 if error */ static DWORD -GetCurrentHwProfile( +SETUPAPI_GetCurrentHwProfile( IN HDEVINFO DeviceInfoSet) { HKEY hKey = NULL; @@ -3032,7 +3026,7 @@ dwConfigFlags &= ~(PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED); else dwConfigFlags |= (PropChange->Scope == DICS_FLAG_GLOBAL ? CONFIGFLAG_DISABLED : CSCONFIGFLAG_DISABLED); - rc = RegSetValueEx( + rc = RegSetValueExW( hKey, RegistryValueName, 0, @@ -3047,7 +3041,7 @@ /* Enable/disable device if needed */ if (PropChange->Scope == DICS_FLAG_GLOBAL || PropChange->HwProfile == 0 - || PropChange->HwProfile == GetCurrentHwProfile(DeviceInfoSet)) + || PropChange->HwProfile == SETUPAPI_GetCurrentHwProfile(DeviceInfoSet)) { if (PropChange->StateChange == DICS_ENABLE) ret = ResetDevice(DeviceInfoSet, DeviceInfoData); @@ -3169,7 +3163,7 @@ Result = SetupInstallFromInfSectionW(InstallParams.hwndParent, SelectedDriver->InfFileDetails->hInf, SectionName, DoAction, hKey, SelectedDriver->InfFileDetails->DirectoryName, SP_COPY_NEWER, - SetupDefaultQueueCallback, Context, + SetupDefaultQueueCallbackW, Context, DeviceInfoSet, DeviceInfoData); if (!Result) goto cleanup; @@ -3415,7 +3409,7 @@ Result = SetupInstallFromInfSectionW(InstallParams.hwndParent, SelectedDriver->InfFileDetails->hInf, SectionName, DoAction, hKey, SelectedDriver->InfFileDetails->DirectoryName, SP_COPY_NEWER, - SetupDefaultQueueCallback, Context, + SetupDefaultQueueCallbackW, Context, DeviceInfoSet, DeviceInfoData); if (!Result) goto cleanup; @@ -3434,27 +3428,27 @@ TRACE("InfSectionExt : '%s'\n", debugstr_w(&SectionName[strlenW(SelectedDriver->Details.SectionName)])); TRACE("MatchingDeviceId: '%s'\n", debugstr_w(SelectedDriver->MatchingId)); TRACE("ProviderName : '%s'\n", debugstr_w(SelectedDriver->Info.ProviderName)); - sprintfW(Buffer, L"%u-%u-%u", DriverDate.wMonth, DriverDate.wDay, DriverDate.wYear); - rc = RegSetValueEx(hKey, REGSTR_DRIVER_DATE, 0, REG_SZ, (const BYTE *)Buffer, (strlenW(Buffer) + 1) * sizeof(WCHAR)); + sprintfW(Buffer, DateFormat, DriverDate.wMonth, DriverDate.wDay, DriverDate.wYear); + rc = RegSetValueExW(hKey, REGSTR_DRIVER_DATE, 0, REG_SZ, (const BYTE *)Buffer, (strlenW(Buffer) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_DRIVER_DATE_DATA, 0, REG_BINARY, (const BYTE *)&SelectedDriver->Info.DriverDate, sizeof(FILETIME)); + rc = RegSetValueExW(hKey, REGSTR_DRIVER_DATE_DATA, 0, REG_BINARY, (const BYTE *)&SelectedDriver->Info.DriverDate, sizeof(FILETIME)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_DRVDESC, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (strlenW(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_DRVDESC, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (strlenW(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) { - sprintfW(Buffer, L"%u.%u.%u.%u", fullVersion.HighPart >> 16, fullVersion.HighPart & 0xffff, fullVersion.LowPart >> 16, fullVersion.LowPart & 0xffff); - rc = RegSetValueEx(hKey, REGSTR_DRIVER_VERSION, 0, REG_SZ, (const BYTE *)Buffer, (strlenW(Buffer) + 1) * sizeof(WCHAR)); + sprintfW(Buffer, VersionFormat, fullVersion.HighPart >> 16, fullVersion.HighPart & 0xffff, fullVersion.LowPart >> 16, fullVersion.LowPart & 0xffff); + rc = RegSetValueExW(hKey, REGSTR_DRIVER_VERSION, 0, REG_SZ, (const BYTE *)Buffer, (strlenW(Buffer) + 1) * sizeof(WCHAR)); } if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_INFPATH, 0, REG_SZ, (const BYTE *)SelectedDriver->InfFileDetails->FileName, (strlenW(SelectedDriver->InfFileDetails->FileName) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_INFPATH, 0, REG_SZ, (const BYTE *)SelectedDriver->InfFileDetails->FileName, (strlenW(SelectedDriver->InfFileDetails->FileName) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_INFSECTION, 0, REG_SZ, (const BYTE *)SelectedDriver->Details.SectionName, (strlenW(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_INFSECTION, 0, REG_SZ, (const BYTE *)SelectedDriver->Details.SectionName, (strlenW(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_INFSECTIONEXT, 0, REG_SZ, (const BYTE *)&SectionName[strlenW(SelectedDriver->Details.SectionName)], (strlenW(SectionName) - strlenW(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_INFSECTIONEXT, 0, REG_SZ, (const BYTE *)&SectionName[strlenW(SelectedDriver->Details.SectionName)], (strlenW(SectionName) - strlenW(SelectedDriver->Details.SectionName) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_MATCHINGDEVID, 0, REG_SZ, (const BYTE *)SelectedDriver->MatchingId, (strlenW(SelectedDriver->MatchingId) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_MATCHINGDEVID, 0, REG_SZ, (const BYTE *)SelectedDriver->MatchingId, (strlenW(SelectedDriver->MatchingId) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_PROVIDER_NAME, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.ProviderName, (strlenW(SelectedDriver->Info.ProviderName) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_PROVIDER_NAME, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.ProviderName, (strlenW(SelectedDriver->Info.ProviderName) + 1) * sizeof(WCHAR)); if (rc != ERROR_SUCCESS) { SetLastError(rc); @@ -3504,13 +3498,13 @@ TRACE("ClassGUID : '%s'\n", debugstr_w(lpFullGuidString)); TRACE("DeviceDesc : '%s'\n", debugstr_w(SelectedDriver->Info.Description)); TRACE("Mfg : '%s'\n", debugstr_w(SelectedDriver->Info.MfgName)); - rc = RegSetValueEx(hKey, REGSTR_VAL_CLASS, 0, REG_SZ, (const BYTE *)ClassName, (strlenW(ClassName) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_CLASS, 0, REG_SZ, (const BYTE *)ClassName, (strlenW(ClassName) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_CLASSGUID, 0, REG_SZ, (const BYTE *)lpFullGuidString, (strlenW(lpFullGuidString) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_CLASSGUID, 0, REG_SZ, (const BYTE *)lpFullGuidString, (strlenW(lpFullGuidString) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_DEVDESC, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (strlenW(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_DEVDESC, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.Description, (strlenW(SelectedDriver->Info.Description) + 1) * sizeof(WCHAR)); if (rc == ERROR_SUCCESS) - rc = RegSetValueEx(hKey, REGSTR_VAL_MFG, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.MfgName, (strlenW(SelectedDriver->Info.MfgName) + 1) * sizeof(WCHAR)); + rc = RegSetValueExW(hKey, REGSTR_VAL_MFG, 0, REG_SZ, (const BYTE *)SelectedDriver->Info.MfgName, (strlenW(SelectedDriver->Info.MfgName) + 1) * sizeof(WCHAR)); if (rc != ERROR_SUCCESS) { SetLastError(rc);
Modified: trunk/reactos/dll/win32/setupapi/driver.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/driver.c... ============================================================================== --- trunk/reactos/dll/win32/setupapi/driver.c (original) +++ trunk/reactos/dll/win32/setupapi/driver.c Thu May 24 01:40:46 2007 @@ -138,15 +138,15 @@ driverInfo->Params.cbSize = sizeof(SP_DRVINSTALL_PARAMS); driverInfo->Params.Reserved = (ULONG_PTR)driverInfo;
- driverInfo->Details.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA); + driverInfo->Details.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA_W); driverInfo->Details.Reserved = (ULONG_PTR)driverInfo;
/* Copy InfFileName field */ - strncpyW(driverInfo->Details.InfFileName, InfFile, MAX_PATH - 1); + lstrcpynW(driverInfo->Details.InfFileName, InfFile, MAX_PATH - 1); driverInfo->Details.InfFileName[MAX_PATH - 1] = '\0';
/* Fill InfDate field */ - hFile = CreateFile( + hFile = CreateFileW( InfFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); @@ -157,13 +157,13 @@ goto cleanup;
/* Fill SectionName field */ - strncpyW(driverInfo->Details.SectionName, SectionName, LINE_LEN); + lstrcpynW(driverInfo->Details.SectionName, SectionName, LINE_LEN); pDot = strchrW(driverInfo->Details.SectionName, '.'); if (pDot) *pDot = UNICODE_NULL;
/* Fill DrvDescription field */ - strncpyW(driverInfo->Details.DrvDescription, DriverDescription, LINE_LEN); + lstrcpynW(driverInfo->Details.DrvDescription, DriverDescription, LINE_LEN);
/* Copy MatchingId information */ if (MatchingId) @@ -188,13 +188,13 @@ memcpy(&driverInfo->ClassGuid, ClassGuid, sizeof(GUID)); driverInfo->Info.DriverType = DriverType; driverInfo->Info.Reserved = (ULONG_PTR)driverInfo; - strncpyW(driverInfo->Info.Description, driverInfo->Details.DrvDescription, LINE_LEN - 1); + lstrcpynW(driverInfo->Info.Description, driverInfo->Details.DrvDescription, LINE_LEN - 1); driverInfo->Info.Description[LINE_LEN - 1] = '\0'; - strncpyW(driverInfo->Info.MfgName, ManufacturerName, LINE_LEN - 1); + lstrcpynW(driverInfo->Info.MfgName, ManufacturerName, LINE_LEN - 1); driverInfo->Info.MfgName[LINE_LEN - 1] = '\0'; if (ProviderName) { - strncpyW(driverInfo->Info.ProviderName, ProviderName, LINE_LEN - 1); + lstrcpynW(driverInfo->Info.ProviderName, ProviderName, LINE_LEN - 1); driverInfo->Info.ProviderName[LINE_LEN - 1] = '\0'; } else @@ -2152,7 +2152,7 @@ Context = SetupInitDefaultQueueCallback(InstallParams.hwndParent); if (!Context) goto cleanup; - InstallMsgHandler = SetupDefaultQueueCallback; + InstallMsgHandler = SetupDefaultQueueCallbackW; InstallMsgHandlerContext = Context; } ret = SetupInstallFromInfSectionW(InstallParams.hwndParent,
Modified: trunk/reactos/dll/win32/setupapi/install.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/install.... ============================================================================== --- trunk/reactos/dll/win32/setupapi/install.c (original) +++ trunk/reactos/dll/win32/setupapi/install.c Thu May 24 01:40:46 2007 @@ -25,7 +25,20 @@
/* Unicode constants */ static const WCHAR BackSlash[] = {'\',0}; +static const WCHAR GroupOrderListKey[] = {'S','Y','S','T','E','M','\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\','C','o','n','t','r','o','l','\','G','r','o','u','p','O','r','d','e','r','L','i','s','t',0}; static const WCHAR InfDirectory[] = {'i','n','f','\',0}; +static const WCHAR OemFileMask[] = {'o','e','m','*','.','i','n','f',0}; +static const WCHAR OemFileSpecification[] = {'o','e','m','%','l','u','.','i','n','f',0}; + +static const WCHAR DependenciesKey[] = {'D','e','p','e','n','d','e','n','c','i','e','s',0}; +static const WCHAR DescriptionKey[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; +static const WCHAR DisplayNameKey[] = {'D','i','s','p','l','a','y','N','a','m','e',0}; +static const WCHAR ErrorControlKey[] = {'E','r','r','o','r','C','o','n','t','r','o','l',0}; +static const WCHAR LoadOrderGroupKey[] = {'L','o','a','d','O','r','d','e','r','G','r','o','u','p',0}; +static const WCHAR SecurityKey[] = {'S','e','c','u','r','i','t','y',0}; +static const WCHAR ServiceBinaryKey[] = {'S','e','r','v','i','c','e','B','i','n','a','r','y',0}; +static const WCHAR ServiceTypeKey[] = {'S','e','r','v','i','c','e','T','y','p','e',0}; +static const WCHAR StartTypeKey[] = {'S','t','a','r','t','T','y','p','e',0};
/* info passed to callback functions dealing with files */ struct files_callback_info @@ -90,6 +103,9 @@ static const WCHAR Include[] = {'I','n','c','l','u','d','e',0}; static const WCHAR Needs[] = {'N','e','e','d','s',0}; static const WCHAR DotSecurity[] = {'.','S','e','c','u','r','i','t','y',0}; +#ifdef __WINESRC__ +static const WCHAR WineFakeDlls[] = {'W','i','n','e','F','a','k','e','D','l','l','s',0}; +#endif
/*********************************************************************** @@ -411,7 +427,7 @@ MyFree(security_key); if (ok) { - if (!SetupGetLineText( &security_context, NULL, NULL, NULL, NULL, 0, &required )) + if (!SetupGetLineTextW( &security_context, NULL, NULL, NULL, NULL, 0, &required )) return FALSE; security_descriptor = MyMalloc( required * sizeof(WCHAR) ); if (!security_descriptor) @@ -419,7 +435,7 @@ SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } - if (!SetupGetLineText( &security_context, NULL, NULL, NULL, security_descriptor, required, NULL )) + if (!SetupGetLineTextW( &security_context, NULL, NULL, NULL, security_descriptor, required, NULL )) return FALSE; ok = ConvertStringSecurityDescriptorToSecurityDescriptorW( security_descriptor, SDDL_REVISION_1, &sd, NULL ); MyFree( security_descriptor ); @@ -1306,7 +1322,7 @@ SC_HANDLE hSCManager = NULL; SC_HANDLE hService = NULL; LPDWORD GroupOrder = NULL; - LPQUERY_SERVICE_CONFIG ServiceConfig = NULL; + LPQUERY_SERVICE_CONFIGW ServiceConfig = NULL; BOOL ret = FALSE;
HKEY hGroupOrderListKey = NULL; @@ -1322,11 +1338,11 @@ DWORD tagId = (DWORD)-1; BOOL useTag;
- if (!GetIntField(hInf, ServiceSection, L"ServiceType", &ServiceType)) + if (!GetIntField(hInf, ServiceSection, ServiceTypeKey, &ServiceType)) goto cleanup; - if (!GetIntField(hInf, ServiceSection, L"StartType", &StartType)) + if (!GetIntField(hInf, ServiceSection, StartTypeKey, &StartType)) goto cleanup; - if (!GetIntField(hInf, ServiceSection, L"ErrorControl", &ErrorControl)) + if (!GetIntField(hInf, ServiceSection, ErrorControlKey, &ErrorControl)) goto cleanup; useTag = (ServiceType == SERVICE_BOOT_START || ServiceType == SERVICE_SYSTEM_START);
@@ -1334,15 +1350,15 @@ if (hSCManager == NULL) goto cleanup;
- if (!GetLineText(hInf, ServiceSection, L"ServiceBinary", &ServiceBinary)) + if (!GetLineText(hInf, ServiceSection, ServiceBinaryKey, &ServiceBinary)) goto cleanup;
/* Don't check return value, as these fields are optional and * GetLineText initialize output parameter even on failure */ - GetLineText(hInf, ServiceSection, L"LoadOrderGroup", &LoadOrderGroup); - GetLineText(hInf, ServiceSection, L"DisplayName", &DisplayName); - GetLineText(hInf, ServiceSection, L"Description", &Description); - GetLineText(hInf, ServiceSection, L"Dependencies", &Dependencies); + GetLineText(hInf, ServiceSection, LoadOrderGroupKey, &LoadOrderGroup); + GetLineText(hInf, ServiceSection, DisplayNameKey, &DisplayName); + GetLineText(hInf, ServiceSection, DescriptionKey, &Description); + GetLineText(hInf, ServiceSection, DependenciesKey, &Dependencies);
hService = OpenServiceW( hSCManager, @@ -1413,7 +1429,7 @@ }
/* Set security */ - if (GetLineText(hInf, ServiceSection, L"Security", &SecurityDescriptor)) + if (GetLineText(hInf, ServiceSection, SecurityKey, &SecurityDescriptor)) { ret = ConvertStringSecurityDescriptorToSecurityDescriptorW(SecurityDescriptor, SDDL_REVISION_1, &sd, NULL); if (!ret) @@ -1436,9 +1452,9 @@ if ((ServiceFlags & SPSVCINST_NOCLOBBER_LOADORDERGROUP) && ServiceConfig && ServiceConfig->lpLoadOrderGroup) lpLoadOrderGroup = ServiceConfig->lpLoadOrderGroup;
- rc = RegOpenKey( + rc = RegOpenKeyW( list ? list->HKLM : HKEY_LOCAL_MACHINE, - L"SYSTEM\CurrentControlSet\Control\GroupOrderList", + GroupOrderListKey, &hGroupOrderListKey); if (rc != ERROR_SUCCESS) { @@ -1809,7 +1825,7 @@ strcatW(pFullFileName, BackSlash); strcatW(pFullFileName, InfDirectory); pFileName = &pFullFileName[strlenW(pFullFileName)]; - sprintfW(pFileName, L"oem*.inf", NextFreeNumber); + sprintfW(pFileName, OemFileMask, NextFreeNumber); hSearch = FindFirstFileW(pFullFileName, &FindFileData); if (hSearch == INVALID_HANDLE_VALUE) { @@ -1821,12 +1837,12 @@ do { DWORD CurrentNumber; - if (swscanf(FindFileData.cFileName, L"oem%lu.inf", &CurrentNumber) == 1 + if (swscanf(FindFileData.cFileName, OemFileSpecification, &CurrentNumber) == 1 && CurrentNumber <= 99999) { NextFreeNumber = CurrentNumber + 1; } - } while (FindNextFile(hSearch, &FindFileData)); + } while (FindNextFileW(hSearch, &FindFileData)); }
if (NextFreeNumber > 99999) @@ -1837,7 +1853,7 @@ }
/* Create the full path: %WINDIR%\Inf\OEM{XXXXX}.inf */ - sprintfW(pFileName, L"oem%lu.inf", NextFreeNumber); + sprintfW(pFileName, OemFileSpecification, NextFreeNumber); TRACE("Next available file is %s\n", debugstr_w(pFileName));
if (RequiredSize)
Modified: trunk/reactos/dll/win32/setupapi/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/misc.c?r... ============================================================================== --- trunk/reactos/dll/win32/setupapi/misc.c (original) +++ trunk/reactos/dll/win32/setupapi/misc.c Thu May 24 01:40:46 2007 @@ -21,6 +21,10 @@ #include "setupapi_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(setupapi); + +/* Unicode constants */ +static const WCHAR BackSlash[] = {'\',0}; +static const WCHAR TranslationRegKey[] = {'\','V','e','r','F','i','l','e','I','n','f','o','\','T','r','a','n','s','l','a','t','i','o','n',0};
DWORD GetFunctionPointer( @@ -1190,7 +1194,7 @@ return FALSE; }
- if (!VerQueryValueW(lpInfo, L"\", + if (!VerQueryValueW(lpInfo, BackSlash, (LPVOID*)&lpFixedInfo, &uSize)) { MyFree(lpInfo); @@ -1201,7 +1205,7 @@ lpFileVersion->HighPart = lpFixedInfo->dwFileVersionMS;
*lpVersionVarSize = 0; - if (!VerQueryValueW(lpInfo, L"\VerFileInfo\Translation", + if (!VerQueryValueW(lpInfo, TranslationRegKey, (LPVOID*)&lpVarSize, &uSize)) { MyFree(lpInfo);
Modified: trunk/reactos/dll/win32/setupapi/parser.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/parser.c... ============================================================================== --- trunk/reactos/dll/win32/setupapi/parser.c (original) +++ trunk/reactos/dll/win32/setupapi/parser.c Thu May 24 01:40:46 2007 @@ -25,6 +25,8 @@
/* Unicode constants */ static const WCHAR BackSlash[] = {'\',0}; +static const WCHAR Class[] = {'C','l','a','s','s',0}; +static const WCHAR ClassGUID[] = {'C','l','a','s','s','G','U','I','D',0}; static const WCHAR InfDirectory[] = {'i','n','f','\',0}; static const WCHAR InfFileSpecification[] = {'*','.','i','n','f',0};
@@ -1073,7 +1075,7 @@
static BOOL -GetInfClassW( +PARSER_GetInfClassW( IN HINF hInf, OUT LPGUID ClassGuid, OUT PWSTR ClassName, @@ -1085,14 +1087,14 @@ BOOL ret = FALSE;
/* Read class Guid */ - if (!SetupGetLineTextW(NULL, hInf, L"Version", L"ClassGUID", guidW, sizeof(guidW), NULL)) + if (!SetupGetLineTextW(NULL, hInf, Version, ClassGUID, guidW, sizeof(guidW), NULL)) goto cleanup; guidW[37] = '\0'; /* Replace the } by a NULL character */ if (UuidFromStringW(&guidW[1], ClassGuid) != RPC_S_OK) goto cleanup;
/* Read class name */ - ret = SetupGetLineTextW(NULL, hInf, L"Version", L"Class", ClassName, ClassNameSize, &requiredSize); + ret = SetupGetLineTextW(NULL, hInf, Version, Class, ClassName, ClassNameSize, &requiredSize); if (ret && ClassName == NULL && ClassNameSize == 0) { if (RequiredSize) @@ -1215,7 +1217,7 @@ SetupCloseInfFile((HINF)file); return NULL; } - else if (!GetInfClassW((HINF)file, &ClassGuid, ClassName, strlenW(class) + 1, NULL)) + else if (!PARSER_GetInfClassW((HINF)file, &ClassGuid, ClassName, strlenW(class) + 1, NULL)) { /* Unable to get class name in .inf file */ HeapFree(GetProcessHeap(), 0, ClassName); @@ -2197,7 +2199,7 @@ if (hInf == INVALID_HANDLE_VALUE) goto cleanup;
- ret = GetInfClassW(hInf, ClassGuid, ClassName, ClassNameSize, RequiredSize); + ret = PARSER_GetInfClassW(hInf, ClassGuid, ClassName, ClassNameSize, RequiredSize);
cleanup: if (hInf != INVALID_HANDLE_VALUE)
Modified: trunk/reactos/dll/win32/setupapi/queue.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/queue.c?... ============================================================================== --- trunk/reactos/dll/win32/setupapi/queue.c (original) +++ trunk/reactos/dll/win32/setupapi/queue.c Thu May 24 01:40:46 2007 @@ -763,7 +763,7 @@ MyFree(security_key); if (ret) { - if (!SetupGetLineText( &security_context, NULL, NULL, NULL, NULL, 0, &required )) + if (!SetupGetLineTextW( &security_context, NULL, NULL, NULL, NULL, 0, &required )) return FALSE; security_descriptor = MyMalloc( required * sizeof(WCHAR) ); if (!security_descriptor) @@ -771,7 +771,7 @@ SetLastError(ERROR_NOT_ENOUGH_MEMORY); return FALSE; } - if (!SetupGetLineText( &security_context, NULL, NULL, NULL, security_descriptor, required, NULL )) + if (!SetupGetLineTextW( &security_context, NULL, NULL, NULL, security_descriptor, required, NULL )) { MyFree( security_descriptor ); return FALSE;