setupapi: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4a8483044e
commit
72d6759f3a
|
@ -4,6 +4,8 @@ IMPORTLIB = setupapi
|
|||
IMPORTS = uuid version advapi32 rpcrt4
|
||||
DELAYIMPORTS = shell32 wintrust ole32 winspool comdlg32 user32
|
||||
|
||||
EXTRADLLFLAGS = -mno-cygwin
|
||||
|
||||
C_SRCS = \
|
||||
devinst.c \
|
||||
dialog.c \
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
|
@ -36,7 +33,6 @@
|
|||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "cfgmgr32.h"
|
||||
#include "winioctl.h"
|
||||
#include "rpc.h"
|
||||
|
@ -282,7 +278,7 @@ static void SETUPDI_GuidToString(const GUID *guid, LPWSTR guidStr)
|
|||
'X','%','0','2','X','%','0','2','X','%','0','2','X','%','0','2','X','%',
|
||||
'0','2','X','}',0};
|
||||
|
||||
sprintfW(guidStr, fmt, guid->Data1, guid->Data2, guid->Data3,
|
||||
swprintf(guidStr, 39, fmt, guid->Data1, guid->Data2, guid->Data3,
|
||||
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
||||
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
||||
}
|
||||
|
@ -291,7 +287,7 @@ static WCHAR *get_iface_key_path(struct device_iface *iface)
|
|||
{
|
||||
static const WCHAR slashW[] = {'\\',0};
|
||||
WCHAR *path, *ptr;
|
||||
size_t len = strlenW(DeviceClasses) + 1 + 38 + 1 + strlenW(iface->symlink);
|
||||
size_t len = lstrlenW(DeviceClasses) + 1 + 38 + 1 + lstrlenW(iface->symlink);
|
||||
|
||||
if (!(path = heap_alloc((len + 1) * sizeof(WCHAR))))
|
||||
{
|
||||
|
@ -299,16 +295,16 @@ static WCHAR *get_iface_key_path(struct device_iface *iface)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
strcpyW(path, DeviceClasses);
|
||||
strcatW(path, slashW);
|
||||
SETUPDI_GuidToString(&iface->class, path + strlenW(path));
|
||||
strcatW(path, slashW);
|
||||
ptr = path + strlenW(path);
|
||||
strcatW(path, iface->symlink);
|
||||
if (strlenW(iface->symlink) > 3)
|
||||
lstrcpyW(path, DeviceClasses);
|
||||
lstrcatW(path, slashW);
|
||||
SETUPDI_GuidToString(&iface->class, path + lstrlenW(path));
|
||||
lstrcatW(path, slashW);
|
||||
ptr = path + lstrlenW(path);
|
||||
lstrcatW(path, iface->symlink);
|
||||
if (lstrlenW(iface->symlink) > 3)
|
||||
ptr[0] = ptr[1] = ptr[3] = '#';
|
||||
|
||||
ptr = strchrW(ptr, '\\');
|
||||
ptr = wcschr(ptr, '\\');
|
||||
if (ptr) *ptr = 0;
|
||||
|
||||
return path;
|
||||
|
@ -319,10 +315,10 @@ static WCHAR *get_refstr_key_path(struct device_iface *iface)
|
|||
static const WCHAR hashW[] = {'#',0};
|
||||
static const WCHAR slashW[] = {'\\',0};
|
||||
WCHAR *path, *ptr;
|
||||
size_t len = strlenW(DeviceClasses) + 1 + 38 + 1 + strlenW(iface->symlink) + 1 + 1;
|
||||
size_t len = lstrlenW(DeviceClasses) + 1 + 38 + 1 + lstrlenW(iface->symlink) + 1 + 1;
|
||||
|
||||
if (iface->refstr)
|
||||
len += strlenW(iface->refstr);
|
||||
len += lstrlenW(iface->refstr);
|
||||
|
||||
if (!(path = heap_alloc((len + 1) * sizeof(WCHAR))))
|
||||
{
|
||||
|
@ -330,23 +326,23 @@ static WCHAR *get_refstr_key_path(struct device_iface *iface)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
strcpyW(path, DeviceClasses);
|
||||
strcatW(path, slashW);
|
||||
SETUPDI_GuidToString(&iface->class, path + strlenW(path));
|
||||
strcatW(path, slashW);
|
||||
ptr = path + strlenW(path);
|
||||
strcatW(path, iface->symlink);
|
||||
if (strlenW(iface->symlink) > 3)
|
||||
lstrcpyW(path, DeviceClasses);
|
||||
lstrcatW(path, slashW);
|
||||
SETUPDI_GuidToString(&iface->class, path + lstrlenW(path));
|
||||
lstrcatW(path, slashW);
|
||||
ptr = path + lstrlenW(path);
|
||||
lstrcatW(path, iface->symlink);
|
||||
if (lstrlenW(iface->symlink) > 3)
|
||||
ptr[0] = ptr[1] = ptr[3] = '#';
|
||||
|
||||
ptr = strchrW(ptr, '\\');
|
||||
ptr = wcschr(ptr, '\\');
|
||||
if (ptr) *ptr = 0;
|
||||
|
||||
strcatW(path, slashW);
|
||||
strcatW(path, hashW);
|
||||
lstrcatW(path, slashW);
|
||||
lstrcatW(path, hashW);
|
||||
|
||||
if (iface->refstr)
|
||||
strcatW(path, iface->refstr);
|
||||
lstrcatW(path, iface->refstr);
|
||||
|
||||
return path;
|
||||
}
|
||||
|
@ -393,11 +389,11 @@ static LPWSTR SETUPDI_CreateSymbolicLinkPath(LPCWSTR instanceId,
|
|||
ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
if (ret)
|
||||
{
|
||||
int printed = sprintfW(ret, fmt, instanceId, guidStr);
|
||||
int printed = swprintf(ret, len, fmt, instanceId, guidStr);
|
||||
LPWSTR ptr;
|
||||
|
||||
/* replace '\\' with '#' after the "\\\\?\\" beginning */
|
||||
for (ptr = strchrW(ret + 4, '\\'); ptr; ptr = strchrW(ptr + 1, '\\'))
|
||||
for (ptr = wcschr(ret + 4, '\\'); ptr; ptr = wcschr(ptr + 1, '\\'))
|
||||
*ptr = '#';
|
||||
if (ReferenceString && *ReferenceString)
|
||||
{
|
||||
|
@ -587,17 +583,17 @@ static LONG create_driver_key(struct device *device, HKEY *key)
|
|||
}
|
||||
|
||||
SETUPDI_GuidToString(&device->class, path);
|
||||
strcatW(path, slash);
|
||||
lstrcatW(path, slash);
|
||||
/* Allocate a new driver key, by finding the first integer value that's not
|
||||
* already taken. */
|
||||
for (;;)
|
||||
{
|
||||
sprintfW(path + 39, formatW, i++);
|
||||
swprintf(path + 39, ARRAY_SIZE(path) - 39, formatW, i++);
|
||||
if ((l = RegCreateKeyExW(class_key, path, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, key, &dispos)))
|
||||
break;
|
||||
else if (dispos == REG_CREATED_NEW_KEY)
|
||||
{
|
||||
RegSetValueExW(device->key, Driver, 0, REG_SZ, (BYTE *)path, strlenW(path) * sizeof(WCHAR));
|
||||
RegSetValueExW(device->key, Driver, 0, REG_SZ, (BYTE *)path, lstrlenW(path) * sizeof(WCHAR));
|
||||
RegCloseKey(class_key);
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
@ -708,9 +704,9 @@ static void remove_device(struct device *device)
|
|||
/* delete all empty parents of the key */
|
||||
if (!RegOpenKeyExW(HKEY_LOCAL_MACHINE, Enum, 0, 0, &enum_key))
|
||||
{
|
||||
strcpyW(id, device->instanceId);
|
||||
lstrcpyW(id, device->instanceId);
|
||||
|
||||
while ((p = strrchrW(id, '\\')))
|
||||
while ((p = wcsrchr(id, '\\')))
|
||||
{
|
||||
*p = 0;
|
||||
RegDeleteKeyW(enum_key, id);
|
||||
|
@ -762,7 +758,7 @@ static struct device *create_device(struct DeviceInfoSet *set,
|
|||
|
||||
LIST_FOR_EACH_ENTRY(device, &set->devices, struct device, entry)
|
||||
{
|
||||
if (!strcmpiW(instanceid, device->instanceId))
|
||||
if (!wcsicmp(instanceid, device->instanceId))
|
||||
{
|
||||
TRACE("Found device %p already in set.\n", device);
|
||||
return device;
|
||||
|
@ -782,7 +778,7 @@ static struct device *create_device(struct DeviceInfoSet *set,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struprW(device->instanceId);
|
||||
wcsupr(device->instanceId);
|
||||
device->set = set;
|
||||
device->key = SETUPDI_CreateDevKey(device);
|
||||
device->phantom = phantom;
|
||||
|
@ -1163,7 +1159,7 @@ BOOL WINAPI SetupDiClassGuidsFromNameExW(
|
|||
{
|
||||
TRACE("Class name: %p\n", szClassName);
|
||||
|
||||
if (strcmpiW(szClassName, ClassName) == 0)
|
||||
if (wcsicmp(szClassName, ClassName) == 0)
|
||||
{
|
||||
TRACE("Found matching class name\n");
|
||||
|
||||
|
@ -1561,7 +1557,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const
|
|||
devinfo, debugstr_w(name), debugstr_guid(class), debugstr_w(description),
|
||||
parent, flags, device_data);
|
||||
|
||||
if (!name || strlenW(name) >= MAX_DEVICE_ID_LEN)
|
||||
if (!name || lstrlenW(name) >= MAX_DEVICE_ID_LEN)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_DEVINST_NAME);
|
||||
return FALSE;
|
||||
|
@ -1586,7 +1582,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const
|
|||
static const WCHAR formatW[] = {'R','O','O','T','\\','%','s','\\','%','0','4','u',0};
|
||||
unsigned int instance_id;
|
||||
|
||||
if (strchrW(name, '\\'))
|
||||
if (wcschr(name, '\\'))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_DEVINST_NAME);
|
||||
return FALSE;
|
||||
|
@ -1594,7 +1590,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const
|
|||
|
||||
for (instance_id = 0; ; ++instance_id)
|
||||
{
|
||||
if (snprintfW(id, ARRAY_SIZE(id), formatW, name, instance_id) == -1)
|
||||
if (swprintf(id, ARRAY_SIZE(id), formatW, name, instance_id) == -1)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_DEVINST_NAME);
|
||||
return FALSE;
|
||||
|
@ -1622,7 +1618,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(HDEVINFO devinfo, const WCHAR *name, const
|
|||
RegCloseKey(enum_hkey);
|
||||
|
||||
/* Check if instance is already in set */
|
||||
strcpyW(id, name);
|
||||
lstrcpyW(id, name);
|
||||
LIST_FOR_EACH_ENTRY(device, &set->devices, struct device, entry)
|
||||
{
|
||||
if (!lstrcmpiW(name, device->instanceId))
|
||||
|
@ -1824,7 +1820,7 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdW(HDEVINFO devinfo, SP_DEVINFO_DATA *devic
|
|||
return FALSE;
|
||||
|
||||
TRACE("instance ID: %s\n", debugstr_w(device->instanceId));
|
||||
if (DeviceInstanceIdSize < strlenW(device->instanceId) + 1)
|
||||
if (DeviceInstanceIdSize < lstrlenW(device->instanceId) + 1)
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
if (RequiredSize)
|
||||
|
@ -2327,7 +2323,7 @@ static void SETUPDI_EnumerateMatchingDeviceInstances(struct DeviceInfoSet *set,
|
|||
static const WCHAR fmt[] =
|
||||
{'%','s','\\','%','s','\\','%','s',0};
|
||||
|
||||
if (snprintfW(id, ARRAY_SIZE(id), fmt, enumerator,
|
||||
if (swprintf(id, ARRAY_SIZE(id), fmt, enumerator,
|
||||
deviceName, deviceInstance) != -1)
|
||||
{
|
||||
create_device(set, &deviceClass, id, FALSE);
|
||||
|
@ -3544,10 +3540,10 @@ static BOOL call_coinstallers(WCHAR *list, DI_FUNCTION function, HDEVINFO devinf
|
|||
char *procname;
|
||||
DWORD ret;
|
||||
|
||||
for (p = list; *p; p += strlenW(p) + 1)
|
||||
for (p = list; *p; p += lstrlenW(p) + 1)
|
||||
{
|
||||
TRACE("Found co-installer %s.\n", debugstr_w(p));
|
||||
if ((procnameW = strchrW(p, ',')))
|
||||
if ((procnameW = wcschr(p, ',')))
|
||||
*procnameW = 0;
|
||||
|
||||
if ((module = LoadLibraryExW(p, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32)))
|
||||
|
@ -3646,7 +3642,7 @@ BOOL WINAPI SetupDiCallClassInstaller(DI_FUNCTION function, HDEVINFO devinfo, SP
|
|||
if (!RegGetValueW(class_key, NULL, installer32W, RRF_RT_REG_SZ, NULL, path, &size))
|
||||
{
|
||||
TRACE("Found class installer %s.\n", debugstr_w(path));
|
||||
if ((procnameW = strchrW(path, ',')))
|
||||
if ((procnameW = wcschr(path, ',')))
|
||||
*procnameW = 0;
|
||||
|
||||
if ((module = LoadLibraryExW(path, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32)))
|
||||
|
@ -3852,7 +3848,7 @@ BOOL WINAPI SetupDiSetDevicePropertyW(HDEVINFO devinfo, PSP_DEVINFO_DATA device_
|
|||
}
|
||||
|
||||
SETUPDI_GuidToString(&key->fmtid, property_hkey_path);
|
||||
sprintfW(property_hkey_path + 38, formatW, key->pid);
|
||||
swprintf(property_hkey_path + 38, ARRAY_SIZE(property_hkey_path) - 38, formatW, key->pid);
|
||||
|
||||
if (type == DEVPROP_TYPE_EMPTY)
|
||||
{
|
||||
|
@ -4200,7 +4196,7 @@ BOOL WINAPI SetupDiGetDevicePropertyW(HDEVINFO devinfo, PSP_DEVINFO_DATA device_
|
|||
}
|
||||
|
||||
SETUPDI_GuidToString(&prop_key->fmtid, key_path + 11);
|
||||
sprintfW(key_path + 49, formatW, prop_key->pid);
|
||||
swprintf(key_path + 49, ARRAY_SIZE(key_path) - 49, formatW, prop_key->pid);
|
||||
|
||||
ls = RegOpenKeyExW(device->key, key_path, 0, KEY_QUERY_VALUE, &hkey);
|
||||
if (!ls)
|
||||
|
@ -4344,7 +4340,7 @@ BOOL WINAPI SetupDiRegisterCoDeviceInstallers(HDEVINFO devinfo, SP_DEVINFO_DATA
|
|||
SetupFindFirstLineW(hinf, driver->mfg_key, driver->description, &ctx);
|
||||
SetupGetStringFieldW(&ctx, 1, coinst_key, ARRAY_SIZE(coinst_key), NULL);
|
||||
SetupDiGetActualSectionToInstallW(hinf, coinst_key, coinst_key_ext, ARRAY_SIZE(coinst_key_ext), NULL, NULL);
|
||||
strcatW(coinst_key_ext, coinstallersW);
|
||||
lstrcatW(coinst_key_ext, coinstallersW);
|
||||
|
||||
if ((l = create_driver_key(device, &driver_key)))
|
||||
{
|
||||
|
@ -4376,9 +4372,9 @@ static BOOL device_matches_id(const struct device *device, const WCHAR *id_type,
|
|||
device_ids = heap_alloc(size);
|
||||
if (!RegGetValueW(device->key, NULL, id_type, RRF_RT_REG_MULTI_SZ, NULL, device_ids, &size))
|
||||
{
|
||||
for (p = device_ids; *p; p += strlenW(p) + 1)
|
||||
for (p = device_ids; *p; p += lstrlenW(p) + 1)
|
||||
{
|
||||
if (!strcmpiW(p, id))
|
||||
if (!wcsicmp(p, id))
|
||||
{
|
||||
heap_free(device_ids);
|
||||
return TRUE;
|
||||
|
@ -4394,14 +4390,14 @@ static BOOL device_matches_id(const struct device *device, const WCHAR *id_type,
|
|||
static BOOL version_is_compatible(const WCHAR *version)
|
||||
{
|
||||
const WCHAR *machine_ext = NtPlatformExtension + 1, *p;
|
||||
size_t len = strlenW(version);
|
||||
size_t len = lstrlenW(version);
|
||||
BOOL wow64;
|
||||
|
||||
/* We are only concerned with architecture. */
|
||||
if ((p = strchrW(version, '.')))
|
||||
if ((p = wcschr(version, '.')))
|
||||
len = p - version;
|
||||
|
||||
if (!strncmpiW(version, NtExtension + 1, len))
|
||||
if (!wcsnicmp(version, NtExtension + 1, len))
|
||||
return TRUE;
|
||||
|
||||
if (IsWow64Process(GetCurrentProcess(), &wow64) && wow64)
|
||||
|
@ -4415,7 +4411,7 @@ static BOOL version_is_compatible(const WCHAR *version)
|
|||
#endif
|
||||
}
|
||||
|
||||
return !strncmpiW(version, machine_ext, len);
|
||||
return !wcsnicmp(version, machine_ext, len);
|
||||
}
|
||||
|
||||
static void enum_compat_drivers_from_file(struct device *device, const WCHAR *path)
|
||||
|
@ -4435,7 +4431,7 @@ static void enum_compat_drivers_from_file(struct device *device, const WCHAR *pa
|
|||
{
|
||||
SetupGetStringFieldW(&ctx, 0, mfg_name, ARRAY_SIZE(mfg_name), NULL);
|
||||
if (!SetupGetStringFieldW(&ctx, 1, mfg_key, ARRAY_SIZE(mfg_key), NULL))
|
||||
strcpyW(mfg_key, mfg_name);
|
||||
lstrcpyW(mfg_key, mfg_name);
|
||||
|
||||
if (SetupGetFieldCount(&ctx) >= 2)
|
||||
{
|
||||
|
@ -4467,9 +4463,9 @@ static void enum_compat_drivers_from_file(struct device *device, const WCHAR *pa
|
|||
unsigned int count = ++device->driver_count;
|
||||
|
||||
device->drivers = heap_realloc(device->drivers, count * sizeof(*device->drivers));
|
||||
strcpyW(device->drivers[count - 1].inf_path, path);
|
||||
strcpyW(device->drivers[count - 1].manufacturer, mfg_name);
|
||||
strcpyW(device->drivers[count - 1].mfg_key, mfg_key_ext);
|
||||
lstrcpyW(device->drivers[count - 1].inf_path, path);
|
||||
lstrcpyW(device->drivers[count - 1].manufacturer, mfg_name);
|
||||
lstrcpyW(device->drivers[count - 1].mfg_key, mfg_key_ext);
|
||||
SetupGetStringFieldW(&ctx, 0, device->drivers[count - 1].description,
|
||||
ARRAY_SIZE(device->drivers[count - 1].description), NULL);
|
||||
|
||||
|
@ -4515,11 +4511,11 @@ BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO devinfo, SP_DEVINFO_DATA *device
|
|||
HANDLE find_handle;
|
||||
|
||||
if (device->params.DriverPath[0])
|
||||
strcpyW(dir, device->params.DriverPath);
|
||||
lstrcpyW(dir, device->params.DriverPath);
|
||||
else
|
||||
strcpyW(dir, default_path);
|
||||
strcatW(dir, backslashW);
|
||||
strcatW(dir, wildcardW);
|
||||
lstrcpyW(dir, default_path);
|
||||
lstrcatW(dir, backslashW);
|
||||
lstrcatW(dir, wildcardW);
|
||||
|
||||
TRACE("Searching for drivers in %s.\n", debugstr_w(dir));
|
||||
|
||||
|
@ -4527,8 +4523,8 @@ BOOL WINAPI SetupDiBuildDriverInfoList(HDEVINFO devinfo, SP_DEVINFO_DATA *device
|
|||
{
|
||||
do
|
||||
{
|
||||
strcpyW(file, dir);
|
||||
strcpyW(file + strlenW(file) - 1, find_data.cFileName);
|
||||
lstrcpyW(file, dir);
|
||||
lstrcpyW(file + lstrlenW(file) - 1, find_data.cFileName);
|
||||
enum_compat_drivers_from_file(device, file);
|
||||
} while (FindNextFileW(find_handle, &find_data));
|
||||
|
||||
|
@ -4575,8 +4571,8 @@ BOOL WINAPI SetupDiEnumDriverInfoW(HDEVINFO devinfo, SP_DEVINFO_DATA *device_dat
|
|||
driver_data->ProviderName[0] = 0;
|
||||
if (SetupFindFirstLineW(hinf, Version, providerW, &ctx))
|
||||
SetupGetStringFieldW(&ctx, 1, driver_data->ProviderName, ARRAY_SIZE(driver_data->ProviderName), NULL);
|
||||
strcpyW(driver_data->Description, device->drivers[index].description);
|
||||
strcpyW(driver_data->MfgName, device->drivers[index].manufacturer);
|
||||
lstrcpyW(driver_data->Description, device->drivers[index].description);
|
||||
lstrcpyW(driver_data->MfgName, device->drivers[index].manufacturer);
|
||||
driver_data->DriverType = SPDIT_COMPATDRIVER;
|
||||
|
||||
SetupCloseInfFile(hinf);
|
||||
|
@ -4751,14 +4747,14 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
|
|||
SetupInstallFromInfSectionW(NULL, hinf, section_ext, install_flags, driver_key, NULL,
|
||||
SP_COPY_NEWER_ONLY, SetupDefaultQueueCallbackW, callback_ctx, NULL, NULL);
|
||||
|
||||
strcpyW(subsection, section_ext);
|
||||
strcatW(subsection, dothwW);
|
||||
lstrcpyW(subsection, section_ext);
|
||||
lstrcatW(subsection, dothwW);
|
||||
|
||||
SetupInstallFromInfSectionW(NULL, hinf, subsection, install_flags, device_key, NULL,
|
||||
SP_COPY_NEWER_ONLY, SetupDefaultQueueCallbackW, callback_ctx, NULL, NULL);
|
||||
|
||||
strcpyW(subsection, section_ext);
|
||||
strcatW(subsection, dotservicesW);
|
||||
lstrcpyW(subsection, section_ext);
|
||||
lstrcatW(subsection, dotservicesW);
|
||||
SetupInstallServicesFromInfSectionW(hinf, subsection, 0);
|
||||
|
||||
svc_name[0] = 0;
|
||||
|
@ -4771,7 +4767,7 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
|
|||
if (SetupGetIntField(&ctx, 2, &flags) && (flags & SPSVCINST_ASSOCSERVICE))
|
||||
{
|
||||
if (SetupGetStringFieldW(&ctx, 1, svc_name, ARRAY_SIZE(svc_name), NULL) && svc_name[0])
|
||||
RegSetValueExW(device->key, Service, 0, REG_SZ, (BYTE *)svc_name, strlenW(svc_name) * sizeof(WCHAR));
|
||||
RegSetValueExW(device->key, Service, 0, REG_SZ, (BYTE *)svc_name, lstrlenW(svc_name) * sizeof(WCHAR));
|
||||
break;
|
||||
}
|
||||
} while (SetupFindNextMatchLineW(&ctx, addserviceW, &ctx));
|
||||
|
@ -4783,15 +4779,15 @@ BOOL WINAPI SetupDiInstallDevice(HDEVINFO devinfo, SP_DEVINFO_DATA *device_data)
|
|||
SetupCopyOEMInfW(driver->inf_path, NULL, SPOST_NONE, 0, inf_path, ARRAY_SIZE(inf_path), NULL, &filepart);
|
||||
TRACE("Copied INF file %s to %s.\n", debugstr_w(driver->inf_path), debugstr_w(inf_path));
|
||||
|
||||
RegSetValueExW(driver_key, infpathW, 0, REG_SZ, (BYTE *)filepart, strlenW(filepart) * sizeof(WCHAR));
|
||||
RegSetValueExW(driver_key, infsectionW, 0, REG_SZ, (BYTE *)section, strlenW(section) * sizeof(WCHAR));
|
||||
RegSetValueExW(driver_key, infpathW, 0, REG_SZ, (BYTE *)filepart, lstrlenW(filepart) * sizeof(WCHAR));
|
||||
RegSetValueExW(driver_key, infsectionW, 0, REG_SZ, (BYTE *)section, lstrlenW(section) * sizeof(WCHAR));
|
||||
if (extptr)
|
||||
RegSetValueExW(driver_key, infsectionextW, 0, REG_SZ, (BYTE *)extptr, strlenW(extptr) * sizeof(WCHAR));
|
||||
RegSetValueExW(driver_key, infsectionextW, 0, REG_SZ, (BYTE *)extptr, lstrlenW(extptr) * sizeof(WCHAR));
|
||||
|
||||
RegCloseKey(device_key);
|
||||
RegCloseKey(driver_key);
|
||||
|
||||
if (!strncmpiW(device->instanceId, rootW, strlenW(rootW)) && svc_name[0]
|
||||
if (!wcsnicmp(device->instanceId, rootW, lstrlenW(rootW)) && svc_name[0]
|
||||
&& (manager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT)))
|
||||
{
|
||||
if ((service = OpenServiceW(manager, svc_name, SERVICE_START)))
|
||||
|
|
|
@ -31,8 +31,6 @@
|
|||
#include "winnls.h"
|
||||
#include "setupapi_private.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
||||
|
||||
struct promptdisk_params {
|
||||
|
@ -98,7 +96,7 @@ static void promptdisk_ok(HWND hwnd, struct promptdisk_params *params)
|
|||
int requiredSize;
|
||||
WCHAR aux[MAX_PATH];
|
||||
GetWindowTextW(GetDlgItem(hwnd, IDC_PATH), aux, MAX_PATH);
|
||||
requiredSize = strlenW(aux)+1;
|
||||
requiredSize = lstrlenW(aux)+1;
|
||||
|
||||
if(params->PathRequiredSize)
|
||||
{
|
||||
|
@ -115,7 +113,7 @@ static void promptdisk_ok(HWND hwnd, struct promptdisk_params *params)
|
|||
EndDialog(hwnd, DPROMPT_BUFFERTOOSMALL);
|
||||
return;
|
||||
}
|
||||
strcpyW(params->PathBuffer, aux);
|
||||
lstrcpyW(params->PathBuffer, aux);
|
||||
TRACE("returning PathBuffer=%s\n", debugstr_w(params->PathBuffer));
|
||||
EndDialog(hwnd, DPROMPT_SUCCESS);
|
||||
}
|
||||
|
@ -133,11 +131,11 @@ static void promptdisk_browse(HWND hwnd, struct promptdisk_params *params)
|
|||
ofn.hwndOwner = hwnd;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrFile = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR));
|
||||
strcpyW(ofn.lpstrFile, params->FileSought);
|
||||
lstrcpyW(ofn.lpstrFile, params->FileSought);
|
||||
|
||||
if(GetOpenFileNameW(&ofn))
|
||||
{
|
||||
WCHAR* last_slash = strrchrW(ofn.lpstrFile, '\\');
|
||||
WCHAR* last_slash = wcsrchr(ofn.lpstrFile, '\\');
|
||||
if (last_slash) *last_slash = 0;
|
||||
SetDlgItemTextW(hwnd, IDC_PATH, ofn.lpstrFile);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "winspool.h"
|
||||
#include "setupapi.h"
|
||||
#include "shlobj.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "setupapi_private.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -61,10 +60,10 @@ static const WCHAR *get_unknown_dirid(void)
|
|||
|
||||
if (!unknown_dirid)
|
||||
{
|
||||
UINT len = GetSystemDirectoryW( NULL, 0 ) + strlenW(unknown_str);
|
||||
UINT len = GetSystemDirectoryW( NULL, 0 ) + lstrlenW(unknown_str);
|
||||
if (!(unknown_dirid = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
|
||||
GetSystemDirectoryW( unknown_dirid, len );
|
||||
strcatW( unknown_dirid, unknown_str );
|
||||
lstrcatW( unknown_dirid, unknown_str );
|
||||
}
|
||||
return unknown_dirid;
|
||||
}
|
||||
|
@ -101,23 +100,23 @@ static const WCHAR *create_system_dirid( int dirid )
|
|||
break;
|
||||
case DIRID_DRIVERS:
|
||||
GetSystemDirectoryW( buffer, MAX_PATH );
|
||||
strcatW( buffer, Drivers );
|
||||
lstrcatW( buffer, Drivers );
|
||||
break;
|
||||
case DIRID_INF:
|
||||
GetWindowsDirectoryW( buffer, MAX_PATH );
|
||||
strcatW( buffer, Inf );
|
||||
lstrcatW( buffer, Inf );
|
||||
break;
|
||||
case DIRID_HELP:
|
||||
GetWindowsDirectoryW( buffer, MAX_PATH );
|
||||
strcatW( buffer, Help );
|
||||
lstrcatW( buffer, Help );
|
||||
break;
|
||||
case DIRID_FONTS:
|
||||
GetWindowsDirectoryW( buffer, MAX_PATH );
|
||||
strcatW( buffer, Fonts );
|
||||
lstrcatW( buffer, Fonts );
|
||||
break;
|
||||
case DIRID_VIEWERS:
|
||||
GetSystemDirectoryW( buffer, MAX_PATH );
|
||||
strcatW( buffer, Viewers );
|
||||
lstrcatW( buffer, Viewers );
|
||||
break;
|
||||
case DIRID_APPS:
|
||||
return C_Root; /* FIXME */
|
||||
|
@ -128,12 +127,12 @@ static const WCHAR *create_system_dirid( int dirid )
|
|||
return C_Root; /* FIXME */
|
||||
case DIRID_SYSTEM16:
|
||||
GetWindowsDirectoryW( buffer, MAX_PATH );
|
||||
strcatW( buffer, System );
|
||||
lstrcatW( buffer, System );
|
||||
break;
|
||||
case DIRID_SPOOL:
|
||||
case DIRID_SPOOLDRIVERS: /* FIXME */
|
||||
GetWindowsDirectoryW( buffer, MAX_PATH );
|
||||
strcatW( buffer, Spool );
|
||||
lstrcatW( buffer, Spool );
|
||||
break;
|
||||
case DIRID_USERPROFILE:
|
||||
if (GetEnvironmentVariableW( UserProfile, buffer, MAX_PATH )) break;
|
||||
|
@ -152,7 +151,7 @@ static const WCHAR *create_system_dirid( int dirid )
|
|||
FIXME( "unknown dirid %d\n", dirid );
|
||||
return get_unknown_dirid();
|
||||
}
|
||||
len = (strlenW(buffer) + 1) * sizeof(WCHAR);
|
||||
len = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
|
||||
if ((str = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( str, buffer, len );
|
||||
return str;
|
||||
}
|
||||
|
@ -167,7 +166,7 @@ static const WCHAR *get_csidl_dir( DWORD csidl )
|
|||
FIXME( "CSIDL %x not found\n", csidl );
|
||||
return get_unknown_dirid();
|
||||
}
|
||||
len = (strlenW(buffer) + 1) * sizeof(WCHAR);
|
||||
len = (lstrlenW(buffer) + 1) * sizeof(WCHAR);
|
||||
if ((str = HeapAlloc( GetProcessHeap(), 0, len ))) memcpy( str, buffer, len );
|
||||
return str;
|
||||
}
|
||||
|
@ -288,7 +287,7 @@ BOOL WINAPI SetupSetDirectoryIdW( HINF hinf, DWORD id, PCWSTR dir )
|
|||
}
|
||||
|
||||
/* duplicate the string */
|
||||
len = (strlenW(dir)+1) * sizeof(WCHAR);
|
||||
len = (lstrlenW(dir)+1) * sizeof(WCHAR);
|
||||
if (!(str = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE;
|
||||
memcpy( str, dir, len );
|
||||
return store_user_dirid( hinf, id, str );
|
||||
|
|
|
@ -192,7 +192,7 @@ BOOL WINAPI SetupQuerySpaceRequiredOnDriveW(HDSKSPC DiskSpace,
|
|||
for (i = 0; i < list->dwDriveCount; i++)
|
||||
{
|
||||
TRACE("checking drive %s\n",debugstr_w(list->Drives[i].lpzName));
|
||||
if (lstrcmpW(driveW,list->Drives[i].lpzName)==0)
|
||||
if (wcscmp(driveW,list->Drives[i].lpzName)==0)
|
||||
{
|
||||
rc = TRUE;
|
||||
*SpaceRequired = list->Drives[i].dwWantedSpace;
|
||||
|
|
|
@ -18,20 +18,10 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_DIRENT_H
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define COBJMACROS
|
||||
#define ATL_INITGUID
|
||||
|
@ -43,8 +33,6 @@
|
|||
#include "winuser.h"
|
||||
#include "winnt.h"
|
||||
#include "winternl.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/library.h"
|
||||
#include "wine/debug.h"
|
||||
#include "ole2.h"
|
||||
#include "atliface.h"
|
||||
|
@ -62,7 +50,7 @@ static void *file_buffer;
|
|||
static SIZE_T file_buffer_size;
|
||||
static unsigned int handled_count;
|
||||
static unsigned int handled_total;
|
||||
static char **handled_dlls;
|
||||
static WCHAR **handled_dlls;
|
||||
static IRegistrar *registrar;
|
||||
|
||||
struct dll_info
|
||||
|
@ -75,6 +63,15 @@ struct dll_info
|
|||
|
||||
#define ALIGN(size,align) (((size) + (align) - 1) & ~((align) - 1))
|
||||
|
||||
static const WCHAR winedlldirW[] = {'W','I','N','E','D','L','L','D','I','R','%','u',0};
|
||||
static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0};
|
||||
static const WCHAR programsW[] = {'\\','p','r','o','g','r','a','m','s',0};
|
||||
static const WCHAR dllsW[] = {'\\','d','l','l','s',0};
|
||||
static const WCHAR fakedllsW[] = {'\\','f','a','k','e','d','l','l','s',0};
|
||||
static const WCHAR dllW[] = {'.','d','l','l',0};
|
||||
static const WCHAR exeW[] = {'.','e','x','e',0};
|
||||
static const WCHAR fakeW[] = {'.','f','a','k','e',0};
|
||||
|
||||
/* contents of the dll sections */
|
||||
|
||||
static const BYTE dll_code_section[] = { 0x31, 0xc0, /* xor %eax,%eax */
|
||||
|
@ -120,74 +117,39 @@ static inline void add_directory( struct dll_info *info, unsigned int idx, DWORD
|
|||
info->nt->OptionalHeader.DataDirectory[idx].Size = size;
|
||||
}
|
||||
|
||||
/* convert a dll name W->A without depending on the current codepage */
|
||||
static char *dll_name_WtoA( char *nameA, const WCHAR *nameW, unsigned int len )
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
char c = nameW[i];
|
||||
if (nameW[i] > 127) return NULL;
|
||||
if (c >= 'A' && c <= 'Z') c += 'a' - 'A';
|
||||
nameA[i] = c;
|
||||
}
|
||||
nameA[i] = 0;
|
||||
return nameA;
|
||||
}
|
||||
|
||||
/* convert a dll name A->W without depending on the current codepage */
|
||||
static WCHAR *dll_name_AtoW( WCHAR *nameW, const char *nameA, unsigned int len )
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < len; i++) nameW[i] = nameA[i];
|
||||
nameW[i] = 0;
|
||||
return nameW;
|
||||
}
|
||||
|
||||
/* add a dll to the list of dll that have been taken care of */
|
||||
static BOOL add_handled_dll( const WCHAR *name )
|
||||
{
|
||||
unsigned int len = strlenW( name );
|
||||
int i, min, max, pos, res;
|
||||
char *nameA;
|
||||
|
||||
if (!(nameA = HeapAlloc( GetProcessHeap(), 0, len + 1 ))) return FALSE;
|
||||
if (!dll_name_WtoA( nameA, name, len )) goto failed;
|
||||
|
||||
min = 0;
|
||||
max = handled_count - 1;
|
||||
while (min <= max)
|
||||
{
|
||||
pos = (min + max) / 2;
|
||||
res = strcmp( handled_dlls[pos], nameA );
|
||||
if (!res) goto failed; /* already in the list */
|
||||
res = wcscmp( handled_dlls[pos], name );
|
||||
if (!res) return FALSE; /* already in the list */
|
||||
if (res < 0) min = pos + 1;
|
||||
else max = pos - 1;
|
||||
}
|
||||
|
||||
if (handled_count >= handled_total)
|
||||
{
|
||||
char **new_dlls;
|
||||
WCHAR **new_dlls;
|
||||
unsigned int new_count = max( 64, handled_total * 2 );
|
||||
|
||||
if (handled_dlls) new_dlls = HeapReAlloc( GetProcessHeap(), 0, handled_dlls,
|
||||
new_count * sizeof(*handled_dlls) );
|
||||
else new_dlls = HeapAlloc( GetProcessHeap(), 0, new_count * sizeof(*handled_dlls) );
|
||||
if (!new_dlls) goto failed;
|
||||
if (!new_dlls) return FALSE;
|
||||
handled_dlls = new_dlls;
|
||||
handled_total = new_count;
|
||||
}
|
||||
|
||||
for (i = handled_count; i > min; i--) handled_dlls[i] = handled_dlls[i - 1];
|
||||
handled_dlls[i] = nameA;
|
||||
handled_dlls[i] = wcsdup( name );
|
||||
handled_count++;
|
||||
return TRUE;
|
||||
|
||||
failed:
|
||||
HeapFree( GetProcessHeap(), 0, nameA );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static int is_valid_ptr( const void *data, SIZE_T size, const void *ptr, SIZE_T ptr_size )
|
||||
|
@ -236,8 +198,9 @@ static void extract_16bit_image( IMAGE_NT_HEADERS *nt, void **data, SIZE_T *size
|
|||
|
||||
/* read in the contents of a file into the global file buffer */
|
||||
/* return 1 on success, 0 on nonexistent file, -1 on other error */
|
||||
static int read_file( const char *name, void **data, SIZE_T *size, BOOL expect_builtin )
|
||||
static int read_file( const WCHAR *name, void **data, SIZE_T *size, BOOL expect_builtin )
|
||||
{
|
||||
static const WCHAR sixteenW[] = {'1','6',0};
|
||||
struct stat st;
|
||||
int fd, ret = -1;
|
||||
size_t header_size;
|
||||
|
@ -247,7 +210,7 @@ static int read_file( const char *name, void **data, SIZE_T *size, BOOL expect_b
|
|||
const size_t min_size = sizeof(*dos) + 32 +
|
||||
FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader.MajorLinkerVersion );
|
||||
|
||||
if ((fd = open( name, O_RDONLY | O_BINARY )) == -1) return 0;
|
||||
if ((fd = _wopen( name, O_RDONLY | O_BINARY )) == -1) return 0;
|
||||
if (fstat( fd, &st ) == -1) goto done;
|
||||
*size = st.st_size;
|
||||
if (!file_buffer || st.st_size > file_buffer_size)
|
||||
|
@ -263,7 +226,7 @@ static int read_file( const char *name, void **data, SIZE_T *size, BOOL expect_b
|
|||
|
||||
if (st.st_size < min_size) goto done;
|
||||
header_size = min( st.st_size, 4096 );
|
||||
if (pread( fd, file_buffer, header_size, 0 ) != header_size) goto done;
|
||||
if (read( fd, file_buffer, header_size ) != header_size) goto done;
|
||||
dos = file_buffer;
|
||||
if (dos->e_magic != IMAGE_DOS_SIGNATURE) goto done;
|
||||
if (dos->e_lfanew < strlen(signature) + 1) goto done;
|
||||
|
@ -278,11 +241,11 @@ static int read_file( const char *name, void **data, SIZE_T *size, BOOL expect_b
|
|||
goto done;
|
||||
}
|
||||
if (st.st_size == header_size ||
|
||||
pread( fd, (char *)file_buffer + header_size,
|
||||
st.st_size - header_size, header_size ) == st.st_size - header_size)
|
||||
read( fd, (char *)file_buffer + header_size,
|
||||
st.st_size - header_size ) == st.st_size - header_size)
|
||||
{
|
||||
*data = file_buffer;
|
||||
if (strlen(name) > 2 && !strcmp( name + strlen(name) - 2, "16" ))
|
||||
if (lstrlenW(name) > 2 && !wcscmp( name + lstrlenW(name) - 2, sixteenW ))
|
||||
extract_16bit_image( nt, data, size );
|
||||
ret = 1;
|
||||
}
|
||||
|
@ -367,8 +330,8 @@ static BOOL build_fake_dll( HANDLE file, const WCHAR *name )
|
|||
nt->OptionalHeader.AddressOfEntryPoint = info.mem_pos;
|
||||
nt->OptionalHeader.BaseOfCode = info.mem_pos;
|
||||
|
||||
ext = strrchrW( name, '.' );
|
||||
if (!ext || strcmpiW( ext, dotexeW )) nt->FileHeader.Characteristics |= IMAGE_FILE_DLL;
|
||||
ext = wcsrchr( name, '.' );
|
||||
if (!ext || wcsicmp( ext, dotexeW )) nt->FileHeader.Characteristics |= IMAGE_FILE_DLL;
|
||||
|
||||
if (nt->FileHeader.Characteristics & IMAGE_FILE_DLL)
|
||||
{
|
||||
|
@ -419,50 +382,57 @@ static void create_directories( const WCHAR *name )
|
|||
WCHAR *path, *p;
|
||||
|
||||
/* create the directory/directories */
|
||||
path = HeapAlloc(GetProcessHeap(), 0, (strlenW(name) + 1)*sizeof(WCHAR));
|
||||
strcpyW(path, name);
|
||||
path = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name) + 1)*sizeof(WCHAR));
|
||||
lstrcpyW(path, name);
|
||||
|
||||
p = strchrW(path, '\\');
|
||||
p = wcschr(path, '\\');
|
||||
while (p != NULL)
|
||||
{
|
||||
*p = 0;
|
||||
if (!CreateDirectoryW(path, NULL))
|
||||
TRACE("Couldn't create directory %s - error: %d\n", wine_dbgstr_w(path), GetLastError());
|
||||
*p = '\\';
|
||||
p = strchrW(p+1, '\\');
|
||||
p = wcschr(p+1, '\\');
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, path);
|
||||
}
|
||||
|
||||
static inline char *prepend( char *buffer, const char *str, size_t len )
|
||||
static inline WCHAR *prepend( WCHAR *buffer, const WCHAR *str, size_t len )
|
||||
{
|
||||
return memcpy( buffer - len, str, len );
|
||||
return memcpy( buffer - len, str, len * sizeof(WCHAR) );
|
||||
}
|
||||
|
||||
static const WCHAR *enum_load_path( unsigned int idx )
|
||||
{
|
||||
WCHAR buffer[32];
|
||||
swprintf( buffer, ARRAY_SIZE(buffer), winedlldirW, idx );
|
||||
return _wgetenv( buffer );
|
||||
}
|
||||
|
||||
/* try to load a pre-compiled fake dll */
|
||||
static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
|
||||
{
|
||||
const char *build_dir = wine_get_build_dir();
|
||||
const char *path;
|
||||
char *file, *ptr;
|
||||
const WCHAR *build_dir = _wgetenv( winebuilddirW );
|
||||
const WCHAR *path;
|
||||
WCHAR *file, *ptr;
|
||||
void *data = NULL;
|
||||
unsigned int i, pos, len, namelen, maxlen = 0;
|
||||
WCHAR *p;
|
||||
int res = 0;
|
||||
|
||||
if ((p = strrchrW( name, '\\' ))) name = p + 1;
|
||||
if ((p = wcsrchr( name, '\\' ))) name = p + 1;
|
||||
|
||||
i = 0;
|
||||
len = strlenW( name );
|
||||
if (build_dir) maxlen = strlen(build_dir) + sizeof("/programs/") + len;
|
||||
while ((path = wine_dll_enum_load_path( i++ ))) maxlen = max( maxlen, strlen(path) );
|
||||
maxlen += sizeof("/fakedlls") + len + sizeof(".fake");
|
||||
len = lstrlenW( name );
|
||||
if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(programsW) + len + 1;
|
||||
while ((path = enum_load_path( i++ ))) maxlen = max( maxlen, lstrlenW(path) );
|
||||
maxlen += ARRAY_SIZE(fakedllsW) + len + ARRAY_SIZE(fakeW);
|
||||
|
||||
if (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen ))) return NULL;
|
||||
if (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen * sizeof(WCHAR) ))) return NULL;
|
||||
|
||||
pos = maxlen - len - sizeof(".fake");
|
||||
if (!dll_name_WtoA( file + pos, name, len )) goto done;
|
||||
file[--pos] = '/';
|
||||
pos = maxlen - len - ARRAY_SIZE(fakeW);
|
||||
lstrcpyW( file + pos, name );
|
||||
file[--pos] = '\\';
|
||||
|
||||
if (build_dir)
|
||||
{
|
||||
|
@ -470,34 +440,34 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
|
|||
ptr = file + pos;
|
||||
namelen = len + 1;
|
||||
file[pos + len + 1] = 0;
|
||||
if (namelen > 4 && !memcmp( ptr + namelen - 4, ".dll", 4 )) namelen -= 4;
|
||||
if (namelen > 4 && !wcsncmp( ptr + namelen - 4, dllW, 4 )) namelen -= 4;
|
||||
ptr = prepend( ptr, ptr, namelen );
|
||||
ptr = prepend( ptr, "/dlls", sizeof("/dlls") - 1 );
|
||||
ptr = prepend( ptr, build_dir, strlen(build_dir) );
|
||||
ptr = prepend( ptr, dllsW, ARRAY_SIZE(dllsW) - 1 );
|
||||
ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
|
||||
if ((res = read_file( ptr, &data, size, TRUE ))) goto done;
|
||||
strcpy( file + pos + len + 1, ".fake" );
|
||||
lstrcpyW( file + pos + len + 1, fakeW );
|
||||
if ((res = read_file( ptr, &data, size, FALSE ))) goto done;
|
||||
|
||||
/* now as a program */
|
||||
ptr = file + pos;
|
||||
namelen = len + 1;
|
||||
file[pos + len + 1] = 0;
|
||||
if (namelen > 4 && !memcmp( ptr + namelen - 4, ".exe", 4 )) namelen -= 4;
|
||||
if (namelen > 4 && !wcsncmp( ptr + namelen - 4, exeW, 4 )) namelen -= 4;
|
||||
ptr = prepend( ptr, ptr, namelen );
|
||||
ptr = prepend( ptr, "/programs", sizeof("/programs") - 1 );
|
||||
ptr = prepend( ptr, build_dir, strlen(build_dir) );
|
||||
ptr = prepend( ptr, programsW, ARRAY_SIZE(programsW) - 1 );
|
||||
ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
|
||||
if ((res = read_file( ptr, &data, size, TRUE ))) goto done;
|
||||
strcpy( file + pos + len + 1, ".fake" );
|
||||
lstrcpyW( file + pos + len + 1, fakeW );
|
||||
if ((res = read_file( ptr, &data, size, FALSE ))) goto done;
|
||||
}
|
||||
|
||||
file[pos + len + 1] = 0;
|
||||
for (i = 0; (path = wine_dll_enum_load_path( i )); i++)
|
||||
for (i = 0; (path = enum_load_path( i )); i++)
|
||||
{
|
||||
ptr = prepend( file + pos, path, strlen(path) );
|
||||
ptr = prepend( file + pos, path, lstrlenW(path) );
|
||||
if ((res = read_file( ptr, &data, size, TRUE ))) break;
|
||||
ptr = prepend( file + pos, "/fakedlls", sizeof("/fakedlls") - 1 );
|
||||
ptr = prepend( ptr, path, strlen(path) );
|
||||
ptr = prepend( file + pos, fakedllsW, ARRAY_SIZE(fakedllsW) - 1 );
|
||||
ptr = prepend( ptr, path, lstrlenW(path) );
|
||||
if ((res = read_file( ptr, &data, size, FALSE ))) break;
|
||||
}
|
||||
|
||||
|
@ -675,7 +645,7 @@ static void get_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, c
|
|||
buffer[pos++] = '_';
|
||||
pos += MultiByteToWideChar( CP_UTF8, 0, lang->ptr, lang->len, buffer + pos, size - pos );
|
||||
memcpy( buffer + pos, trailerW, sizeof(trailerW) );
|
||||
strlwrW( buffer );
|
||||
wcslwr( buffer );
|
||||
}
|
||||
|
||||
static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, const xmlstr_t *name,
|
||||
|
@ -689,11 +659,11 @@ static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, cons
|
|||
HANDLE handle;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!(filename = strrchrW( dll_name, '\\' ))) filename = dll_name;
|
||||
if (!(filename = wcsrchr( dll_name, '\\' ))) filename = dll_name;
|
||||
else filename++;
|
||||
|
||||
path_len = GetWindowsDirectoryW( NULL, 0 ) + 1 + ARRAY_SIZE( winsxsW )
|
||||
+ arch->len + name->len + key->len + version->len + 18 + strlenW( filename ) + 1;
|
||||
+ arch->len + name->len + key->len + version->len + 18 + lstrlenW( filename ) + 1;
|
||||
|
||||
path = HeapAlloc( GetProcessHeap(), 0, path_len * sizeof(WCHAR) );
|
||||
pos = GetWindowsDirectoryW( path, path_len );
|
||||
|
@ -701,9 +671,9 @@ static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, cons
|
|||
memcpy( path + pos, winsxsW, sizeof(winsxsW) );
|
||||
pos += ARRAY_SIZE( winsxsW );
|
||||
get_manifest_filename( arch, name, key, version, lang, path + pos, path_len - pos );
|
||||
pos += strlenW( path + pos );
|
||||
pos += lstrlenW( path + pos );
|
||||
path[pos++] = '\\';
|
||||
strcpyW( path + pos, filename );
|
||||
lstrcpyW( path + pos, filename );
|
||||
handle = create_dest_file( path );
|
||||
if (handle && handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -736,7 +706,7 @@ static BOOL create_manifest( const xmlstr_t *arch, const xmlstr_t *name, const x
|
|||
memcpy( path + pos, winsxsW, sizeof(winsxsW) );
|
||||
pos += ARRAY_SIZE( winsxsW );
|
||||
get_manifest_filename( arch, name, key, version, lang, path + pos, MAX_PATH - pos );
|
||||
strcatW( path + pos, extensionW );
|
||||
lstrcatW( path + pos, extensionW );
|
||||
handle = CreateFileW( path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
|
||||
if (handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
|
@ -785,7 +755,7 @@ static BOOL CALLBACK register_manifest( HMODULE module, const WCHAR *type, WCHAR
|
|||
SIZE_T len;
|
||||
HRSRC rsrc;
|
||||
|
||||
if (IS_INTRESOURCE( res_name ) || strncmpW( res_name, manifestW, ARRAY_SIZE( manifestW )))
|
||||
if (IS_INTRESOURCE( res_name ) || wcsncmp( res_name, manifestW, ARRAY_SIZE( manifestW )))
|
||||
return TRUE;
|
||||
|
||||
rsrc = FindResourceW( module, res_name, type );
|
||||
|
@ -897,21 +867,23 @@ static void register_fake_dll( const WCHAR *name, const void *data, size_t size
|
|||
}
|
||||
|
||||
/* copy a fake dll file to the dest directory */
|
||||
static int install_fake_dll( WCHAR *dest, char *file, const char *ext, BOOL expect_builtin )
|
||||
static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL expect_builtin )
|
||||
{
|
||||
static const WCHAR sixteenW[] = {'1','6',0};
|
||||
int ret;
|
||||
SIZE_T size;
|
||||
void *data;
|
||||
DWORD written;
|
||||
WCHAR *destname = dest + strlenW(dest);
|
||||
char *name = strrchr( file, '/' ) + 1;
|
||||
char *end = name + strlen(name);
|
||||
WCHAR *destname = dest + lstrlenW(dest);
|
||||
WCHAR *name = wcsrchr( file, '\\' ) + 1;
|
||||
WCHAR *end = name + lstrlenW(name);
|
||||
|
||||
strcpy( end, ext );
|
||||
if (ext) lstrcpyW( end, ext );
|
||||
if (!(ret = read_file( file, &data, &size, expect_builtin ))) return 0;
|
||||
|
||||
if (end > name + 2 && !strncmp( end - 2, "16", 2 )) end -= 2; /* remove "16" suffix */
|
||||
dll_name_AtoW( destname, name, end - name );
|
||||
if (end > name + 2 && !wcsncmp( end - 2, sixteenW, 2 )) end -= 2; /* remove "16" suffix */
|
||||
memcpy( destname, name, (end - name) * sizeof(WCHAR) );
|
||||
destname[end - name] = 0;
|
||||
if (!add_handled_dll( destname )) ret = -1;
|
||||
|
||||
if (ret != -1)
|
||||
|
@ -920,7 +892,7 @@ static int install_fake_dll( WCHAR *dest, char *file, const char *ext, BOOL expe
|
|||
|
||||
if (h && h != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
TRACE( "%s -> %s\n", debugstr_a(file), debugstr_w(dest) );
|
||||
TRACE( "%s -> %s\n", debugstr_w(file), debugstr_w(dest) );
|
||||
|
||||
ret = (WriteFile( h, data, size, &written, NULL ) && written == size);
|
||||
if (!ret) ERR( "failed to write to %s (error=%u)\n", debugstr_w(dest), GetLastError() );
|
||||
|
@ -934,71 +906,78 @@ static int install_fake_dll( WCHAR *dest, char *file, const char *ext, BOOL expe
|
|||
}
|
||||
|
||||
/* find and install all fake dlls in a given lib directory */
|
||||
static void install_lib_dir( WCHAR *dest, char *file, const char *default_ext, BOOL expect_builtin )
|
||||
static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *default_ext, BOOL expect_builtin )
|
||||
{
|
||||
DIR *dir;
|
||||
struct dirent *de;
|
||||
char *name;
|
||||
static const WCHAR starW[] = {'*',0};
|
||||
static const WCHAR backslashW[] = {'\\',0};
|
||||
static const WCHAR dotW[] = {'.',0};
|
||||
static const WCHAR dotdotW[] = {'.','.',0};
|
||||
WCHAR *name;
|
||||
intptr_t handle;
|
||||
struct _wfinddata_t data;
|
||||
|
||||
if (!(dir = opendir( file ))) return;
|
||||
name = file + strlen(file);
|
||||
*name++ = '/';
|
||||
while ((de = readdir( dir )))
|
||||
file[1] = '\\'; /* change \??\ to \\?\ */
|
||||
name = file + lstrlenW(file);
|
||||
*name++ = '\\';
|
||||
lstrcpyW( name, starW );
|
||||
|
||||
if ((handle = _wfindfirst( file, &data )) == -1) return;
|
||||
do
|
||||
{
|
||||
if (strlen( de->d_name ) > max_dll_name_len) continue;
|
||||
if (!strcmp( de->d_name, "." )) continue;
|
||||
if (!strcmp( de->d_name, ".." )) continue;
|
||||
strcpy( name, de->d_name );
|
||||
if (lstrlenW( data.name ) > max_dll_name_len) continue;
|
||||
if (!wcscmp( data.name, dotW )) continue;
|
||||
if (!wcscmp( data.name, dotdotW )) continue;
|
||||
lstrcpyW( name, data.name );
|
||||
if (default_ext) /* inside build dir */
|
||||
{
|
||||
strcat( name, "/" );
|
||||
strcat( name, de->d_name );
|
||||
if (!strchr( de->d_name, '.' )) strcat( name, default_ext );
|
||||
if (!install_fake_dll( dest, file, "", expect_builtin ))
|
||||
install_fake_dll( dest, file, ".fake", FALSE );
|
||||
lstrcatW( name, backslashW );
|
||||
lstrcatW( name, data.name );
|
||||
if (!wcschr( data.name, '.' )) lstrcatW( name, default_ext );
|
||||
if (!install_fake_dll( dest, file, NULL, expect_builtin ))
|
||||
install_fake_dll( dest, file, fakeW, FALSE );
|
||||
}
|
||||
else install_fake_dll( dest, file, "", expect_builtin );
|
||||
else install_fake_dll( dest, file, NULL, expect_builtin );
|
||||
}
|
||||
closedir( dir );
|
||||
while (!_wfindnext( handle, &data ));
|
||||
_findclose( handle );
|
||||
}
|
||||
|
||||
/* create fake dlls in dirname for all the files we can find */
|
||||
static BOOL create_wildcard_dlls( const WCHAR *dirname )
|
||||
{
|
||||
const char *build_dir = wine_get_build_dir();
|
||||
const char *path;
|
||||
const WCHAR *build_dir = _wgetenv( winebuilddirW );
|
||||
const WCHAR *path;
|
||||
unsigned int i, maxlen = 0;
|
||||
char *file;
|
||||
WCHAR *dest;
|
||||
WCHAR *file, *dest;
|
||||
|
||||
if (build_dir) maxlen = strlen(build_dir) + sizeof("/programs/");
|
||||
for (i = 0; (path = wine_dll_enum_load_path(i)); i++) maxlen = max( maxlen, strlen(path) );
|
||||
maxlen += 2 * max_dll_name_len + 2 + sizeof(".dll.fake");
|
||||
if (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen ))) return FALSE;
|
||||
if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(programsW) + 1;
|
||||
for (i = 0; (path = enum_load_path(i)); i++) maxlen = max( maxlen, lstrlenW(path) );
|
||||
maxlen += 2 * max_dll_name_len + 2 + 10; /* ".dll.fake" */
|
||||
if (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen * sizeof(WCHAR) ))) return FALSE;
|
||||
|
||||
if (!(dest = HeapAlloc( GetProcessHeap(), 0, (strlenW(dirname) + max_dll_name_len) * sizeof(WCHAR) )))
|
||||
if (!(dest = HeapAlloc( GetProcessHeap(), 0, (lstrlenW(dirname) + max_dll_name_len) * sizeof(WCHAR) )))
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, file );
|
||||
return FALSE;
|
||||
}
|
||||
strcpyW( dest, dirname );
|
||||
dest[strlenW(dest) - 1] = 0; /* remove wildcard */
|
||||
lstrcpyW( dest, dirname );
|
||||
dest[lstrlenW(dest) - 1] = 0; /* remove wildcard */
|
||||
|
||||
if (build_dir)
|
||||
{
|
||||
strcpy( file, build_dir );
|
||||
strcat( file, "/dlls" );
|
||||
install_lib_dir( dest, file, ".dll", TRUE );
|
||||
strcpy( file, build_dir );
|
||||
strcat( file, "/programs" );
|
||||
install_lib_dir( dest, file, ".exe", TRUE );
|
||||
lstrcpyW( file, build_dir );
|
||||
lstrcatW( file, dllsW );
|
||||
install_lib_dir( dest, file, dllW, TRUE );
|
||||
lstrcpyW( file, build_dir );
|
||||
lstrcatW( file, programsW );
|
||||
install_lib_dir( dest, file, exeW, TRUE );
|
||||
}
|
||||
for (i = 0; (path = wine_dll_enum_load_path( i )); i++)
|
||||
for (i = 0; (path = enum_load_path( i )); i++)
|
||||
{
|
||||
strcpy( file, path );
|
||||
lstrcpyW( file, path );
|
||||
install_lib_dir( dest, file, NULL, TRUE );
|
||||
strcpy( file, path );
|
||||
strcat( file, "/fakedlls" );
|
||||
lstrcpyW( file, path );
|
||||
lstrcatW( file, fakedllsW );
|
||||
install_lib_dir( dest, file, NULL, FALSE );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, file );
|
||||
|
@ -1017,7 +996,7 @@ BOOL create_fake_dll( const WCHAR *name, const WCHAR *source )
|
|||
const WCHAR *filename;
|
||||
void *buffer;
|
||||
|
||||
if (!(filename = strrchrW( name, '\\' ))) filename = name;
|
||||
if (!(filename = wcsrchr( name, '\\' ))) filename = name;
|
||||
else filename++;
|
||||
|
||||
/* check for empty name which means to only create the directory */
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "objbase.h"
|
||||
#include "setupapi.h"
|
||||
#include "setupapi_private.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
||||
|
@ -159,8 +158,8 @@ static BOOL copy_files_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
|
||||
if (!info->src_root)
|
||||
{
|
||||
strcpyW( src_root, PARSER_get_inf_filename( hinf ) );
|
||||
if ((p = strrchrW( src_root, '\\' ))) *p = 0;
|
||||
lstrcpyW( src_root, PARSER_get_inf_filename( hinf ) );
|
||||
if ((p = wcsrchr( src_root, '\\' ))) *p = 0;
|
||||
}
|
||||
|
||||
if (field[0] == '@') /* special case: copy single file */
|
||||
|
@ -212,11 +211,11 @@ static HKEY get_root_key( const WCHAR *name, HKEY def_root )
|
|||
static const WCHAR HKU[] = {'H','K','U',0};
|
||||
static const WCHAR HKR[] = {'H','K','R',0};
|
||||
|
||||
if (!strcmpiW( name, HKCR )) return HKEY_CLASSES_ROOT;
|
||||
if (!strcmpiW( name, HKCU )) return HKEY_CURRENT_USER;
|
||||
if (!strcmpiW( name, HKLM )) return HKEY_LOCAL_MACHINE;
|
||||
if (!strcmpiW( name, HKU )) return HKEY_USERS;
|
||||
if (!strcmpiW( name, HKR )) return def_root;
|
||||
if (!wcsicmp( name, HKCR )) return HKEY_CLASSES_ROOT;
|
||||
if (!wcsicmp( name, HKCU )) return HKEY_CURRENT_USER;
|
||||
if (!wcsicmp( name, HKLM )) return HKEY_LOCAL_MACHINE;
|
||||
if (!wcsicmp( name, HKU )) return HKEY_USERS;
|
||||
if (!wcsicmp( name, HKR )) return def_root;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -242,10 +241,10 @@ static void append_multi_sz_value( HKEY hkey, const WCHAR *value, const WCHAR *s
|
|||
total = size;
|
||||
while (*strings)
|
||||
{
|
||||
int len = strlenW(strings) + 1;
|
||||
int len = lstrlenW(strings) + 1;
|
||||
|
||||
for (p = buffer; *p; p += strlenW(p) + 1)
|
||||
if (!strcmpiW( p, strings )) break;
|
||||
for (p = buffer; *p; p += lstrlenW(p) + 1)
|
||||
if (!wcsicmp( p, strings )) break;
|
||||
|
||||
if (!*p) /* not found, need to append it */
|
||||
{
|
||||
|
@ -284,8 +283,8 @@ static void delete_multi_sz_value( HKEY hkey, const WCHAR *value, const WCHAR *s
|
|||
dst = buffer + size;
|
||||
while (*src)
|
||||
{
|
||||
int len = strlenW(src) + 1;
|
||||
if (strcmpiW( src, string ))
|
||||
int len = lstrlenW(src) + 1;
|
||||
if (wcsicmp( src, string ))
|
||||
{
|
||||
memcpy( dst, src, len * sizeof(WCHAR) );
|
||||
dst += len;
|
||||
|
@ -393,7 +392,7 @@ static BOOL do_reg_operation( HKEY hkey, const WCHAR *value, INFCONTEXT *context
|
|||
|
||||
if (type == REG_DWORD)
|
||||
{
|
||||
DWORD dw = str ? strtoulW( str, NULL, 0 ) : 0;
|
||||
DWORD dw = str ? wcstoul( str, NULL, 0 ) : 0;
|
||||
TRACE( "setting dword %s to %x\n", debugstr_w(value), dw );
|
||||
RegSetValueExW( hkey, value, 0, type, (BYTE *)&dw, sizeof(dw) );
|
||||
}
|
||||
|
@ -552,14 +551,16 @@ static BOOL do_register_dll( struct register_dll_info *info, const WCHAR *path,
|
|||
PROCESS_INFORMATION process_info;
|
||||
WCHAR *cmd_line;
|
||||
BOOL res;
|
||||
DWORD len;
|
||||
static const WCHAR format[] = {'"','%','s','"',' ','%','s',0};
|
||||
static const WCHAR default_args[] = {'/','R','e','g','S','e','r','v','e','r',0};
|
||||
|
||||
FreeLibrary( module );
|
||||
module = NULL;
|
||||
if (!args) args = default_args;
|
||||
cmd_line = HeapAlloc( GetProcessHeap(), 0, (strlenW(path) + strlenW(args) + 4) * sizeof(WCHAR) );
|
||||
sprintfW( cmd_line, format, path, args );
|
||||
len = lstrlenW(path) + lstrlenW(args) + 4;
|
||||
cmd_line = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
||||
swprintf( cmd_line, len, format, path, args );
|
||||
memset( &startup, 0, sizeof(startup) );
|
||||
startup.cb = sizeof(startup);
|
||||
TRACE( "executing %s\n", debugstr_w(cmd_line) );
|
||||
|
@ -681,11 +682,11 @@ static BOOL register_dlls_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
if (!SetupGetStringFieldW( &context, 3, buffer, ARRAY_SIZE( buffer ), NULL ))
|
||||
goto done;
|
||||
if (!(p = HeapReAlloc( GetProcessHeap(), 0, path,
|
||||
(strlenW(path) + strlenW(buffer) + 2) * sizeof(WCHAR) ))) goto done;
|
||||
(lstrlenW(path) + lstrlenW(buffer) + 2) * sizeof(WCHAR) ))) goto done;
|
||||
path = p;
|
||||
p += strlenW(p);
|
||||
p += lstrlenW(p);
|
||||
if (p == path || p[-1] != '\\') *p++ = '\\';
|
||||
strcpyW( p, buffer );
|
||||
lstrcpyW( p, buffer );
|
||||
|
||||
/* get flags */
|
||||
if (!SetupGetIntField( &context, 4, &flags )) flags = 0;
|
||||
|
@ -729,11 +730,11 @@ static BOOL fake_dlls_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
if (!SetupGetStringFieldW( &context, 3, buffer, ARRAY_SIZE( buffer ), NULL ))
|
||||
goto done;
|
||||
if (!(p = HeapReAlloc( GetProcessHeap(), 0, path,
|
||||
(strlenW(path) + strlenW(buffer) + 2) * sizeof(WCHAR) ))) goto done;
|
||||
(lstrlenW(path) + lstrlenW(buffer) + 2) * sizeof(WCHAR) ))) goto done;
|
||||
path = p;
|
||||
p += strlenW(p);
|
||||
p += lstrlenW(p);
|
||||
if (p == path || p[-1] != '\\') *p++ = '\\';
|
||||
strcpyW( p, buffer );
|
||||
lstrcpyW( p, buffer );
|
||||
|
||||
/* get source dll */
|
||||
if (SetupGetStringFieldW( &context, 4, buffer, ARRAY_SIZE( buffer ), NULL ))
|
||||
|
@ -776,17 +777,17 @@ static BOOL update_ini_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
if (!SetupGetStringFieldW( &context, 4, buffer, ARRAY_SIZE( buffer ), NULL ))
|
||||
continue;
|
||||
|
||||
divider = strchrW(buffer,'=');
|
||||
divider = wcschr(buffer,'=');
|
||||
if (divider)
|
||||
{
|
||||
*divider = 0;
|
||||
strcpyW(entry,buffer);
|
||||
lstrcpyW(entry,buffer);
|
||||
divider++;
|
||||
strcpyW(string,divider);
|
||||
lstrcpyW(string,divider);
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpyW(entry,buffer);
|
||||
lstrcpyW(entry,buffer);
|
||||
string[0]=0;
|
||||
}
|
||||
|
||||
|
@ -843,7 +844,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
|
||||
/* calculate filename */
|
||||
SHGetFolderPathW( NULL, CSIDL_COMMON_PROGRAMS, NULL, SHGFP_TYPE_CURRENT, lnkpath );
|
||||
lnkpath_end = lnkpath + strlenW(lnkpath);
|
||||
lnkpath_end = lnkpath + lstrlenW(lnkpath);
|
||||
if (lnkpath_end[-1] != '\\') *lnkpath_end++ = '\\';
|
||||
|
||||
if (!(attrs & FLG_PROFITEM_GROUP) && SetupFindFirstLineW( hinf, field, SubDir, &context ))
|
||||
|
@ -873,7 +874,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
HRESULT initresult=E_FAIL;
|
||||
|
||||
if (lnkpath+MAX_PATH < lnkpath_end + 5) return TRUE;
|
||||
strcpyW( lnkpath_end, dotlnk );
|
||||
lstrcpyW( lnkpath_end, dotlnk );
|
||||
|
||||
TRACE( "link path: %s\n", debugstr_w(lnkpath) );
|
||||
|
||||
|
@ -888,7 +889,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
SetupGetIntField( &context, 1, &dirid );
|
||||
dir = DIRID_get_string( dirid );
|
||||
|
||||
if (dir) dir_len = strlenW(dir);
|
||||
if (dir) dir_len = lstrlenW(dir);
|
||||
|
||||
SetupGetStringFieldW( &context, 2, NULL, 0, &subdir_size );
|
||||
SetupGetStringFieldW( &context, 3, NULL, 0, &filename_size );
|
||||
|
@ -897,7 +898,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
{
|
||||
cmdline = cmdline_end = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * (dir_len+subdir_size+filename_size+1) );
|
||||
|
||||
strcpyW( cmdline_end, dir );
|
||||
lstrcpyW( cmdline_end, dir );
|
||||
cmdline_end += dir_len;
|
||||
if (cmdline_end[-1] != '\\') *cmdline_end++ = '\\';
|
||||
|
||||
|
@ -1226,13 +1227,13 @@ void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, I
|
|||
|
||||
lstrcpynW( section, cmdline, MAX_PATH );
|
||||
|
||||
if (!(s = strchrW( section, ' ' ))) return;
|
||||
if (!(s = wcschr( section, ' ' ))) return;
|
||||
*s++ = 0;
|
||||
while (*s == ' ') s++;
|
||||
mode = atoiW( s );
|
||||
mode = wcstol( s, NULL, 10 );
|
||||
|
||||
/* quoted paths are not allowed on native, the rest of the command line is taken as the path */
|
||||
if (!(s = strchrW( s, ' ' ))) return;
|
||||
if (!(s = wcschr( s, ' ' ))) return;
|
||||
while (*s == ' ') s++;
|
||||
path = s;
|
||||
|
||||
|
@ -1245,7 +1246,7 @@ void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, I
|
|||
|
||||
/* check for <section>.ntx86 (or corresponding name for the current platform)
|
||||
* and then <section>.nt */
|
||||
s = section + strlenW(section);
|
||||
s = section + lstrlenW(section);
|
||||
memcpy( s, nt_platformW, sizeof(nt_platformW) );
|
||||
if (!(SetupFindFirstLineW( hinf, section, NULL, &context )))
|
||||
{
|
||||
|
@ -1260,7 +1261,7 @@ void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, I
|
|||
SetupDefaultQueueCallbackW, callback_context,
|
||||
NULL, NULL );
|
||||
SetupTermDefaultQueueCallback( callback_context );
|
||||
strcatW( section, servicesW );
|
||||
lstrcatW( section, servicesW );
|
||||
SetupInstallServicesFromInfSectionW( hinf, section, 0 );
|
||||
SetupCloseInfFile( hinf );
|
||||
|
||||
|
@ -1586,7 +1587,7 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
{
|
||||
DWORD att;
|
||||
DWORD msize;
|
||||
dir_len = strlenW( dir );
|
||||
dir_len = lstrlenW( dir );
|
||||
if ( !dir_len ) return FALSE;
|
||||
msize = ( 7 + dir_len ) * sizeof( WCHAR ); /* \\*.inf\0 */
|
||||
filter = HeapAlloc( GetProcessHeap(), 0, msize );
|
||||
|
@ -1595,7 +1596,7 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
return FALSE;
|
||||
}
|
||||
strcpyW( filter, dir );
|
||||
lstrcpyW( filter, dir );
|
||||
if ( '\\' == filter[dir_len - 1] )
|
||||
filter[--dir_len] = 0;
|
||||
|
||||
|
@ -1620,9 +1621,9 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
return FALSE;
|
||||
}
|
||||
GetWindowsDirectoryW( filter, msize );
|
||||
strcatW( filter, infdir );
|
||||
lstrcatW( filter, infdir );
|
||||
}
|
||||
strcatW( filter, inf );
|
||||
lstrcatW( filter, inf );
|
||||
|
||||
hdl = FindFirstFileW( filter , &finddata );
|
||||
if ( hdl == INVALID_HANDLE_VALUE )
|
||||
|
@ -1644,7 +1645,7 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
{'$','W','I','N','D','O','W','S',' ','N','T','$',0 };
|
||||
WCHAR signature[ MAX_PATH ];
|
||||
BOOL valid = FALSE;
|
||||
DWORD len = strlenW( finddata.cFileName );
|
||||
DWORD len = lstrlenW( finddata.cFileName );
|
||||
if (!fullname || ( name_len < len ))
|
||||
{
|
||||
name_len = ( name_len < len ) ? len : name_len;
|
||||
|
@ -1658,25 +1659,25 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
return FALSE;
|
||||
}
|
||||
strcpyW( fullname, filter );
|
||||
lstrcpyW( fullname, filter );
|
||||
}
|
||||
fullname[ dir_len + 1] = 0; /* keep '\\' */
|
||||
strcatW( fullname, finddata.cFileName );
|
||||
lstrcatW( fullname, finddata.cFileName );
|
||||
if (!GetPrivateProfileStringW( section, key, NULL, signature, MAX_PATH, fullname ))
|
||||
signature[0] = 0;
|
||||
if( INF_STYLE_OLDNT & style )
|
||||
valid = strcmpiW( sig_win4_1, signature ) &&
|
||||
strcmpiW( sig_win4_2, signature );
|
||||
valid = wcsicmp( sig_win4_1, signature ) &&
|
||||
wcsicmp( sig_win4_2, signature );
|
||||
if( INF_STYLE_WIN4 & style )
|
||||
valid = valid || !strcmpiW( sig_win4_1, signature ) ||
|
||||
!strcmpiW( sig_win4_2, signature );
|
||||
valid = valid || !wcsicmp( sig_win4_1, signature ) ||
|
||||
!wcsicmp( sig_win4_2, signature );
|
||||
if( valid )
|
||||
{
|
||||
size += 1 + strlenW( finddata.cFileName );
|
||||
size += 1 + lstrlenW( finddata.cFileName );
|
||||
if( ptr && insize >= size )
|
||||
{
|
||||
strcpyW( ptr, finddata.cFileName );
|
||||
ptr += 1 + strlenW( finddata.cFileName );
|
||||
lstrcpyW( ptr, finddata.cFileName );
|
||||
ptr += 1 + lstrlenW( finddata.cFileName );
|
||||
*ptr = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include "mscat.h"
|
||||
#include "shlobj.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
#include "setupapi_private.h"
|
||||
|
@ -139,7 +138,7 @@ LPWSTR WINAPI DuplicateString(LPCWSTR lpSrc)
|
|||
if (lpDst == NULL)
|
||||
return NULL;
|
||||
|
||||
strcpyW(lpDst, lpSrc);
|
||||
lstrcpyW(lpDst, lpSrc);
|
||||
|
||||
return lpDst;
|
||||
}
|
||||
|
@ -920,14 +919,14 @@ static BOOL find_existing_inf(const WCHAR *source, WCHAR *target)
|
|||
}
|
||||
|
||||
GetWindowsDirectoryW( target, MAX_PATH );
|
||||
strcatW( target, infW );
|
||||
strcatW( target, wildcardW );
|
||||
lstrcatW( target, infW );
|
||||
lstrcatW( target, wildcardW );
|
||||
if ((find_handle = FindFirstFileW( target, &find_data )) != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
do {
|
||||
GetWindowsDirectoryW( target, MAX_PATH );
|
||||
strcatW( target, infW );
|
||||
strcatW( target, find_data.cFileName );
|
||||
lstrcatW( target, infW );
|
||||
lstrcatW( target, find_data.cFileName );
|
||||
dest_file = CreateFileW( target, FILE_READ_DATA | FILE_READ_ATTRIBUTES,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
NULL, OPEN_EXISTING, 0, NULL );
|
||||
|
@ -999,8 +998,8 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
|
|||
}
|
||||
|
||||
GetWindowsDirectoryW( target, ARRAY_SIZE(target) );
|
||||
strcatW( target, inf );
|
||||
strcatW( target, strrchrW( source, '\\' ) + 1 );
|
||||
lstrcatW( target, inf );
|
||||
lstrcatW( target, wcsrchr( source, '\\' ) + 1 );
|
||||
if (GetFileAttributesW( target ) != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
for (i = 0; i < OEM_INDEX_LIMIT; i++)
|
||||
|
@ -1008,8 +1007,8 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
|
|||
static const WCHAR formatW[] = {'o','e','m','%','u','.','i','n','f',0};
|
||||
|
||||
GetWindowsDirectoryW( target, ARRAY_SIZE(target) );
|
||||
strcatW( target, inf );
|
||||
sprintfW( target + strlenW(target), formatW, i );
|
||||
lstrcatW( target, inf );
|
||||
swprintf( target + lstrlenW(target), ARRAY_SIZE(target) - lstrlenW(target), formatW, i );
|
||||
|
||||
if (GetFileAttributesW( target ) == INVALID_FILE_ATTRIBUTES)
|
||||
break;
|
||||
|
@ -1034,11 +1033,11 @@ BOOL WINAPI SetupCopyOEMInfW( PCWSTR source, PCWSTR location,
|
|||
|
||||
SetupCloseInfFile( hinf );
|
||||
|
||||
strcpyW( source_cat, source );
|
||||
p = strrchrW( source_cat, '\\' );
|
||||
lstrcpyW( source_cat, source );
|
||||
p = wcsrchr( source_cat, '\\' );
|
||||
if (p) p++;
|
||||
else p = source_cat;
|
||||
strcpyW( p, catalog_file );
|
||||
lstrcpyW( p, catalog_file );
|
||||
|
||||
TRACE("installing catalog file %s\n", debugstr_w( source_cat ));
|
||||
|
||||
|
@ -1068,12 +1067,12 @@ done:
|
|||
if (style & SP_COPY_DELETESOURCE)
|
||||
DeleteFileW( source );
|
||||
|
||||
size = strlenW( target ) + 1;
|
||||
size = lstrlenW( target ) + 1;
|
||||
if (dest)
|
||||
{
|
||||
if (buffer_size >= size)
|
||||
{
|
||||
strcpyW( dest, target );
|
||||
lstrcpyW( dest, target );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1082,7 +1081,7 @@ done:
|
|||
}
|
||||
}
|
||||
|
||||
if (filepart) *filepart = strrchrW( target, '\\' ) + 1;
|
||||
if (filepart) *filepart = wcsrchr( target, '\\' ) + 1;
|
||||
if (required_size) *required_size = size;
|
||||
if (ret) SetLastError(ERROR_SUCCESS);
|
||||
|
||||
|
@ -1123,8 +1122,8 @@ BOOL WINAPI SetupUninstallOEMInfW( PCWSTR inf_file, DWORD flags, PVOID reserved
|
|||
|
||||
if (!GetWindowsDirectoryW( target, ARRAY_SIZE( target ))) return FALSE;
|
||||
|
||||
strcatW( target, infW );
|
||||
strcatW( target, inf_file );
|
||||
lstrcatW( target, infW );
|
||||
lstrcatW( target, inf_file );
|
||||
|
||||
if (flags & SUOI_FORCEDELETE)
|
||||
return DeleteFileW(target);
|
||||
|
@ -1511,7 +1510,7 @@ static UINT CALLBACK decompress_or_copy_callback( PVOID context, UINT notificati
|
|||
|
||||
TRACE("Requesting extraction of cabinet file %s\n",
|
||||
wine_dbgstr_w(info->NameInCabinet));
|
||||
strcpyW( info->FullTargetName, context_info->target );
|
||||
lstrcpyW( info->FullTargetName, context_info->target );
|
||||
context_info->has_extracted = TRUE;
|
||||
return FILEOP_DOIT;
|
||||
}
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -38,7 +35,6 @@
|
|||
#include "setupapi.h"
|
||||
#include "setupapi_private.h"
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
||||
|
@ -178,7 +174,7 @@ static void *grow_array( void *array, unsigned int *count, size_t elem )
|
|||
/* get the directory of the inf file (as counted string, not null-terminated) */
|
||||
static const WCHAR *get_inf_dir( const struct inf_file *file, unsigned int *len )
|
||||
{
|
||||
const WCHAR *p = strrchrW( file->filename, '\\' );
|
||||
const WCHAR *p = wcsrchr( file->filename, '\\' );
|
||||
*len = p ? (p + 1 - file->filename) : 0;
|
||||
return file->filename;
|
||||
}
|
||||
|
@ -190,7 +186,7 @@ static int find_section( const struct inf_file *file, const WCHAR *name )
|
|||
unsigned int i;
|
||||
|
||||
for (i = 0; i < file->nb_sections; i++)
|
||||
if (!strcmpiW( name, file->sections[i]->name )) return i;
|
||||
if (!wcsicmp( name, file->sections[i]->name )) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -207,7 +203,7 @@ static struct line *find_line( struct inf_file *file, int section_index, const W
|
|||
for (i = 0, line = section->lines; i < section->nb_lines; i++, line++)
|
||||
{
|
||||
if (line->key_field == -1) continue;
|
||||
if (!strcmpiW( name, file->fields[line->key_field].text )) return line;
|
||||
if (!wcsicmp( name, file->fields[line->key_field].text )) return line;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -310,7 +306,7 @@ static const WCHAR *get_dirid_subst( const struct inf_file *file, int dirid, uns
|
|||
|
||||
if (dirid == DIRID_SRCPATH) return get_inf_dir( file, len );
|
||||
ret = DIRID_get_string( dirid );
|
||||
if (ret) *len = strlenW(ret);
|
||||
if (ret) *len = lstrlenW(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -340,12 +336,12 @@ static const WCHAR *get_string_subst( const struct inf_file *file, const WCHAR *
|
|||
for (i = 0, line = strings_section->lines; i < strings_section->nb_lines; i++, line++)
|
||||
{
|
||||
if (line->key_field == -1) continue;
|
||||
if (strncmpiW( str, file->fields[line->key_field].text, *len )) continue;
|
||||
if (wcsnicmp( str, file->fields[line->key_field].text, *len )) continue;
|
||||
if (!file->fields[line->key_field].text[*len]) break;
|
||||
}
|
||||
if (i == strings_section->nb_lines || !line->nb_fields) goto not_found;
|
||||
field = &file->fields[line->first_field];
|
||||
*len = strlenW( field->text );
|
||||
*len = lstrlenW( field->text );
|
||||
return field->text;
|
||||
|
||||
not_found: /* check for integer id */
|
||||
|
@ -353,7 +349,7 @@ static const WCHAR *get_string_subst( const struct inf_file *file, const WCHAR *
|
|||
{
|
||||
memcpy( dirid_str, str, *len * sizeof(WCHAR) );
|
||||
dirid_str[*len] = 0;
|
||||
dirid = strtolW( dirid_str, &end, 10 );
|
||||
dirid = wcstol( dirid_str, &end, 10 );
|
||||
if (!*end) ret = get_dirid_subst( file, dirid, len );
|
||||
if (no_trailing_slash && ret && *len && ret[*len - 1] == '\\') *len -= 1;
|
||||
HeapFree( GetProcessHeap(), 0, dirid_str );
|
||||
|
@ -440,8 +436,8 @@ static unsigned int PARSER_string_substA( const struct inf_file *file, const WCH
|
|||
static WCHAR *push_string( struct inf_file *file, const WCHAR *string )
|
||||
{
|
||||
WCHAR *ret = file->string_pos;
|
||||
strcpyW( ret, string );
|
||||
file->string_pos += strlenW( ret ) + 1;
|
||||
lstrcpyW( ret, string );
|
||||
file->string_pos += lstrlenW( ret ) + 1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -601,7 +597,7 @@ static const WCHAR *line_start_state( struct parser *parser, const WCHAR *pos )
|
|||
set_state( parser, SECTION_NAME );
|
||||
return p + 1;
|
||||
default:
|
||||
if (isspaceW(*p)) break;
|
||||
if (iswspace(*p)) break;
|
||||
if (parser->cur_section != -1)
|
||||
{
|
||||
parser->start = p;
|
||||
|
@ -676,7 +672,7 @@ static const WCHAR *key_name_state( struct parser *parser, const WCHAR *pos )
|
|||
set_state( parser, EOL_BACKSLASH );
|
||||
return p;
|
||||
default:
|
||||
if (!isspaceW(*p)) token_end = p + 1;
|
||||
if (!iswspace(*p)) token_end = p + 1;
|
||||
else
|
||||
{
|
||||
push_token( parser, p );
|
||||
|
@ -728,7 +724,7 @@ static const WCHAR *value_name_state( struct parser *parser, const WCHAR *pos )
|
|||
set_state( parser, EOL_BACKSLASH );
|
||||
return p;
|
||||
default:
|
||||
if (!isspaceW(*p)) token_end = p + 1;
|
||||
if (!iswspace(*p)) token_end = p + 1;
|
||||
else
|
||||
{
|
||||
push_token( parser, p );
|
||||
|
@ -767,7 +763,7 @@ static const WCHAR *eol_backslash_state( struct parser *parser, const WCHAR *pos
|
|||
set_state( parser, COMMENT );
|
||||
return p + 1;
|
||||
default:
|
||||
if (isspaceW(*p)) continue;
|
||||
if (iswspace(*p)) continue;
|
||||
push_token( parser, p );
|
||||
pop_state( parser );
|
||||
return p;
|
||||
|
@ -822,7 +818,7 @@ static const WCHAR *leading_spaces_state( struct parser *parser, const WCHAR *po
|
|||
set_state( parser, EOL_BACKSLASH );
|
||||
return p;
|
||||
}
|
||||
if (!isspaceW(*p)) break;
|
||||
if (!iswspace(*p)) break;
|
||||
}
|
||||
parser->start = p;
|
||||
pop_state( parser );
|
||||
|
@ -842,7 +838,7 @@ static const WCHAR *trailing_spaces_state( struct parser *parser, const WCHAR *p
|
|||
set_state( parser, EOL_BACKSLASH );
|
||||
return p;
|
||||
}
|
||||
if (!isspaceW(*p)) break;
|
||||
if (!iswspace(*p)) break;
|
||||
}
|
||||
pop_state( parser );
|
||||
return p;
|
||||
|
@ -1023,9 +1019,9 @@ static struct inf_file *parse_file( HANDLE handle, const WCHAR *class, DWORD sty
|
|||
if (line && line->nb_fields > 0)
|
||||
{
|
||||
struct field *field = file->fields + line->first_field;
|
||||
if (!strcmpiW( field->text, Chicago )) goto done;
|
||||
if (!strcmpiW( field->text, WindowsNT )) goto done;
|
||||
if (!strcmpiW( field->text, Windows95 )) goto done;
|
||||
if (!wcsicmp( field->text, Chicago )) goto done;
|
||||
if (!wcsicmp( field->text, WindowsNT )) goto done;
|
||||
if (!wcsicmp( field->text, Windows95 )) goto done;
|
||||
}
|
||||
}
|
||||
if (error_line) *error_line = 0;
|
||||
|
@ -1115,7 +1111,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
|
|||
WCHAR *path, *p;
|
||||
UINT len;
|
||||
|
||||
if (strchrW( name, '\\' ) || strchrW( name, '/' ))
|
||||
if (wcschr( name, '\\' ) || wcschr( name, '/' ))
|
||||
{
|
||||
if (!(len = GetFullPathNameW( name, 0, NULL, NULL ))) return INVALID_HANDLE_VALUE;
|
||||
if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
|
||||
|
@ -1131,21 +1127,21 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
|
|||
static const WCHAR Inf[] = {'\\','i','n','f','\\',0};
|
||||
static const WCHAR System32[] = {'\\','s','y','s','t','e','m','3','2','\\',0};
|
||||
|
||||
len = GetWindowsDirectoryW( NULL, 0 ) + strlenW(name) + 12;
|
||||
len = GetWindowsDirectoryW( NULL, 0 ) + lstrlenW(name) + 12;
|
||||
if (!(path = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
|
||||
{
|
||||
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
GetWindowsDirectoryW( path, len );
|
||||
p = path + strlenW(path);
|
||||
strcpyW( p, Inf );
|
||||
strcatW( p, name );
|
||||
p = path + lstrlenW(path);
|
||||
lstrcpyW( p, Inf );
|
||||
lstrcatW( p, name );
|
||||
handle = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
strcpyW( p, System32 );
|
||||
strcatW( p, name );
|
||||
lstrcpyW( p, System32 );
|
||||
lstrcatW( p, name );
|
||||
handle = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
|
||||
}
|
||||
}
|
||||
|
@ -1223,7 +1219,7 @@ HINF WINAPI SetupOpenMasterInf( VOID )
|
|||
WCHAR Buffer[MAX_PATH];
|
||||
|
||||
GetWindowsDirectoryW( Buffer, MAX_PATH );
|
||||
strcatW( Buffer, Layout );
|
||||
lstrcatW( Buffer, Layout );
|
||||
return SetupOpenInfFileW( Buffer, NULL, INF_STYLE_WIN4, NULL);
|
||||
}
|
||||
|
||||
|
@ -1288,7 +1284,7 @@ BOOL WINAPI SetupEnumInfSectionsW( HINF hinf, UINT index, PWSTR buffer, DWORD si
|
|||
{
|
||||
if (index < file->nb_sections)
|
||||
{
|
||||
DWORD len = strlenW( file->sections[index]->name ) + 1;
|
||||
DWORD len = lstrlenW( file->sections[index]->name ) + 1;
|
||||
if (need) *need = len;
|
||||
if (!buffer)
|
||||
{
|
||||
|
@ -1552,7 +1548,7 @@ BOOL WINAPI SetupFindNextMatchLineW( PINFCONTEXT context_in, PCWSTR key,
|
|||
{
|
||||
if (line->key_field == -1) continue;
|
||||
PARSER_string_substW( file, file->fields[line->key_field].text, buffer, ARRAY_SIZE(buffer) );
|
||||
if (!strcmpiW( key, buffer ))
|
||||
if (!wcsicmp( key, buffer ))
|
||||
{
|
||||
if (context_out != context_in) *context_out = *context_in;
|
||||
context_out->Line = i;
|
||||
|
@ -1573,7 +1569,7 @@ BOOL WINAPI SetupFindNextMatchLineW( PINFCONTEXT context_in, PCWSTR key,
|
|||
for (i = 0, line = section->lines; i < section->nb_lines; i++, line++)
|
||||
{
|
||||
if (line->key_field == -1) continue;
|
||||
if (!strcmpiW( key, file->fields[line->key_field].text ))
|
||||
if (!wcsicmp( key, file->fields[line->key_field].text ))
|
||||
{
|
||||
context_out->Inf = context_in->Inf;
|
||||
context_out->CurrentInf = file;
|
||||
|
@ -1841,7 +1837,7 @@ BOOL WINAPI SetupGetBinaryField( PINFCONTEXT context, DWORD index, BYTE *buffer,
|
|||
{
|
||||
const WCHAR *p;
|
||||
DWORD value = 0;
|
||||
for (p = field->text; *p && isxdigitW(*p); p++)
|
||||
for (p = field->text; *p && iswxdigit(*p); p++)
|
||||
{
|
||||
if ((value <<= 4) > 255)
|
||||
{
|
||||
|
@ -1849,7 +1845,7 @@ BOOL WINAPI SetupGetBinaryField( PINFCONTEXT context, DWORD index, BYTE *buffer,
|
|||
return FALSE;
|
||||
}
|
||||
if (*p <= '9') value |= (*p - '0');
|
||||
else value |= (tolowerW(*p) - 'a' + 10);
|
||||
else value |= (towlower(*p) - 'a' + 10);
|
||||
}
|
||||
buffer[i - index] = value;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
|
@ -28,7 +29,6 @@
|
|||
#include "advpub.h"
|
||||
#include "winnls.h"
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "setupapi_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
||||
|
@ -408,7 +408,7 @@ BOOL WINAPI SetupGetSourceFileLocationW( HINF hinf, PINFCONTEXT context, PCWSTR
|
|||
if (!(source_id_str = get_source_id( hinf, context, filename )))
|
||||
return FALSE;
|
||||
|
||||
*source_id = strtolW( source_id_str, &end, 10 );
|
||||
*source_id = wcstol( source_id_str, &end, 10 );
|
||||
if (end == source_id_str || *end)
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, source_id_str );
|
||||
|
@ -491,7 +491,7 @@ BOOL WINAPI SetupGetSourceInfoW( HINF hinf, UINT source_id, UINT info,
|
|||
TRACE("%p, %d, %d, %p, %d, %p\n", hinf, source_id, info, buffer, buffer_size,
|
||||
required_size);
|
||||
|
||||
sprintfW( source_id_str, fmt, source_id );
|
||||
swprintf( source_id_str, ARRAY_SIZE(source_id_str), fmt, source_id );
|
||||
|
||||
if (!SetupFindFirstLineW( hinf, source_disks_names_platform, source_id_str, &ctx ) &&
|
||||
!SetupFindFirstLineW( hinf, source_disks_names, source_id_str, &ctx ))
|
||||
|
@ -602,7 +602,7 @@ BOOL WINAPI SetupGetTargetPathW( HINF hinf, PINFCONTEXT context, PCWSTR section,
|
|||
GetSystemDirectoryW( systemdir, MAX_PATH );
|
||||
dir = systemdir;
|
||||
}
|
||||
size = strlenW( dir ) + 1;
|
||||
size = lstrlenW( dir ) + 1;
|
||||
if (required_size) *required_size = size;
|
||||
|
||||
if (buffer)
|
||||
|
@ -699,11 +699,11 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationW(
|
|||
* destination (copied) inf file, not the source (original) inf file.
|
||||
* to fix it properly would require building a .pnf file */
|
||||
/* file name is stored in VersionData field of InfInformation */
|
||||
inf_name = strrchrW(inf_path, '\\');
|
||||
inf_name = wcsrchr(inf_path, '\\');
|
||||
if (inf_name) inf_name++;
|
||||
else inf_name = inf_path;
|
||||
|
||||
strcpyW(OriginalFileInfo->OriginalInfName, inf_name);
|
||||
lstrcpyW(OriginalFileInfo->OriginalInfName, inf_name);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "winuser.h"
|
||||
#include "winnls.h"
|
||||
#include "setupapi.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "setupapi_private.h"
|
||||
#include "winver.h"
|
||||
#include "wine/debug.h"
|
||||
|
@ -123,8 +122,8 @@ static void concat_W( WCHAR *buffer, const WCHAR *src1, const WCHAR *src2, const
|
|||
*buffer = 0;
|
||||
if (src1 && *src1)
|
||||
{
|
||||
strcpyW( buffer, src1 );
|
||||
buffer += strlenW(buffer );
|
||||
lstrcpyW( buffer, src1 );
|
||||
buffer += lstrlenW(buffer );
|
||||
if (buffer[-1] != '\\') *buffer++ = '\\';
|
||||
*buffer = 0;
|
||||
if (src2) while (*src2 == '\\') src2++;
|
||||
|
@ -132,15 +131,15 @@ static void concat_W( WCHAR *buffer, const WCHAR *src1, const WCHAR *src2, const
|
|||
|
||||
if (src2)
|
||||
{
|
||||
strcpyW( buffer, src2 );
|
||||
buffer += strlenW(buffer );
|
||||
lstrcpyW( buffer, src2 );
|
||||
buffer += lstrlenW(buffer );
|
||||
if (buffer[-1] != '\\') *buffer++ = '\\';
|
||||
*buffer = 0;
|
||||
if (src3) while (*src3 == '\\') src3++;
|
||||
}
|
||||
|
||||
if (src3)
|
||||
strcpyW( buffer, src3 );
|
||||
lstrcpyW( buffer, src3 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,11 +153,11 @@ static BOOL build_filepathsW( const struct file_op *op, FILEPATHS_W *paths )
|
|||
unsigned int src_len = 1, dst_len = 1;
|
||||
WCHAR *source = (PWSTR)paths->Source, *target = (PWSTR)paths->Target;
|
||||
|
||||
if (op->media) src_len += strlenW(op->media->root) + 1;
|
||||
if (op->src_path) src_len += strlenW(op->src_path) + 1;
|
||||
if (op->src_file) src_len += strlenW(op->src_file) + 1;
|
||||
if (op->dst_path) dst_len += strlenW(op->dst_path) + 1;
|
||||
if (op->dst_file) dst_len += strlenW(op->dst_file) + 1;
|
||||
if (op->media) src_len += lstrlenW(op->media->root) + 1;
|
||||
if (op->src_path) src_len += lstrlenW(op->src_path) + 1;
|
||||
if (op->src_file) src_len += lstrlenW(op->src_file) + 1;
|
||||
if (op->dst_path) dst_len += lstrlenW(op->dst_path) + 1;
|
||||
if (op->dst_file) dst_len += lstrlenW(op->dst_file) + 1;
|
||||
src_len *= sizeof(WCHAR);
|
||||
dst_len *= sizeof(WCHAR);
|
||||
|
||||
|
@ -319,11 +318,11 @@ static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARA
|
|||
SetupGetStringFieldW( &disk_ctx, 2, (WCHAR *)params->SourceTagfile, len, NULL );
|
||||
|
||||
if (SetupGetStringFieldW( &disk_ctx, 4, NULL, 0, &len ) && len > sizeof(WCHAR)
|
||||
&& len < MAX_PATH - strlenW( src_root ) - 1)
|
||||
&& len < MAX_PATH - lstrlenW( src_root ) - 1)
|
||||
{
|
||||
strcatW( src_root, backslashW );
|
||||
SetupGetStringFieldW( &disk_ctx, 4, src_root + strlenW( src_root ),
|
||||
MAX_PATH - strlenW( src_root ), NULL );
|
||||
lstrcatW( src_root, backslashW );
|
||||
SetupGetStringFieldW( &disk_ctx, 4, src_root + lstrlenW( src_root ),
|
||||
MAX_PATH - lstrlenW( src_root ), NULL );
|
||||
}
|
||||
|
||||
if (SetupGetStringFieldW( &file_ctx, 2, NULL, 0, &len ) && len > sizeof(WCHAR) && len < MAX_PATH)
|
||||
|
@ -373,7 +372,7 @@ static UINT WINAPI extract_cab_cb( void *arg, UINT message, UINT_PTR param1, UIN
|
|||
FILE_IN_CABINET_INFO_W *info = (FILE_IN_CABINET_INFO_W *)param1;
|
||||
const WCHAR *filename;
|
||||
|
||||
if ((filename = strrchrW( info->NameInCabinet, '\\' )))
|
||||
if ((filename = wcsrchr( info->NameInCabinet, '\\' )))
|
||||
filename++;
|
||||
else
|
||||
filename = info->NameInCabinet;
|
||||
|
@ -381,7 +380,7 @@ static UINT WINAPI extract_cab_cb( void *arg, UINT message, UINT_PTR param1, UIN
|
|||
if (lstrcmpiW( filename, ctx->src ))
|
||||
return FILEOP_SKIP;
|
||||
|
||||
strcpyW( info->FullTargetName, ctx->dst );
|
||||
lstrcpyW( info->FullTargetName, ctx->dst );
|
||||
return FILEOP_DOIT;
|
||||
}
|
||||
case SPFILENOTIFY_FILEEXTRACTED:
|
||||
|
@ -392,7 +391,7 @@ static UINT WINAPI extract_cab_cb( void *arg, UINT message, UINT_PTR param1, UIN
|
|||
case SPFILENOTIFY_NEEDNEWCABINET:
|
||||
{
|
||||
const CABINET_INFO_W *info = (const CABINET_INFO_W *)param1;
|
||||
strcpyW( (WCHAR *)param2, info->CabinetPath );
|
||||
lstrcpyW( (WCHAR *)param2, info->CabinetPath );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
case SPFILENOTIFY_CABINETINFO:
|
||||
|
@ -414,15 +413,15 @@ static BOOL extract_cabinet_file( const WCHAR *cabinet, const WCHAR *root,
|
|||
static const WCHAR extW[] = {'.','c','a','b',0};
|
||||
static const WCHAR backslashW[] = {'\\',0};
|
||||
struct extract_cab_ctx ctx = {src, dst};
|
||||
int len = strlenW( cabinet );
|
||||
int len = lstrlenW( cabinet );
|
||||
WCHAR path[MAX_PATH];
|
||||
|
||||
/* make sure the cabinet file has a .cab extension */
|
||||
if (len <= 4 || strcmpiW( cabinet + len - 4, extW )) return FALSE;
|
||||
if (len <= 4 || wcsicmp( cabinet + len - 4, extW )) return FALSE;
|
||||
|
||||
strcpyW(path, root);
|
||||
strcatW(path, backslashW);
|
||||
strcatW(path, cabinet);
|
||||
lstrcpyW(path, root);
|
||||
lstrcatW(path, backslashW);
|
||||
lstrcatW(path, cabinet);
|
||||
|
||||
return SetupIterateCabinetW( path, 0, extract_cab_cb, &ctx );
|
||||
}
|
||||
|
@ -508,7 +507,7 @@ BOOL WINAPI SetupQueueCopyIndirectA( SP_FILE_COPY_PARAMS_A *paramsA )
|
|||
|
||||
static BOOL equal_str(const WCHAR *a, const WCHAR *b)
|
||||
{
|
||||
return (!a && !b) || (a && b && !strcmpW(a, b));
|
||||
return (!a && !b) || (a && b && !wcscmp(a, b));
|
||||
}
|
||||
|
||||
static struct source_media *get_source_media(struct file_queue *queue,
|
||||
|
@ -518,7 +517,7 @@ static struct source_media *get_source_media(struct file_queue *queue,
|
|||
|
||||
for (i = 0; i < queue->source_count; ++i)
|
||||
{
|
||||
if (!strcmpW(root, queue->sources[i]->root)
|
||||
if (!wcscmp(root, queue->sources[i]->root)
|
||||
&& equal_str(desc, queue->sources[i]->desc)
|
||||
&& equal_str(tag, queue->sources[i]->tag))
|
||||
{
|
||||
|
@ -528,7 +527,7 @@ static struct source_media *get_source_media(struct file_queue *queue,
|
|||
|
||||
queue->sources = heap_realloc( queue->sources, ++queue->source_count * sizeof(*queue->sources) );
|
||||
queue->sources[i] = heap_alloc( sizeof(*queue->sources[i]) );
|
||||
strcpyW(queue->sources[i]->root, root);
|
||||
lstrcpyW(queue->sources[i]->root, root);
|
||||
queue->sources[i]->desc = strdupW(desc);
|
||||
queue->sources[i]->tag = strdupW(tag);
|
||||
queue->sources[i]->resolved = FALSE;
|
||||
|
@ -670,7 +669,7 @@ BOOL WINAPI SetupQueueDefaultCopyW( HSPFILEQ queue, HINF hinf, PCWSTR src_root,
|
|||
params.LayoutInf = NULL;
|
||||
params.SecurityDescriptor = NULL;
|
||||
|
||||
strcpyW( src_root_buffer, src_root );
|
||||
lstrcpyW( src_root_buffer, src_root );
|
||||
src_path[0] = 0;
|
||||
if (!(params.TargetDirectory = get_destination_dir( hinf, NULL ))) return FALSE;
|
||||
get_source_info( hinf, src_file, ¶ms, src_root_buffer, src_path );
|
||||
|
@ -815,7 +814,7 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
|
|||
params.LayoutInf = NULL;
|
||||
params.SecurityDescriptor = NULL;
|
||||
|
||||
strcpyW( src_root_buffer, src_root );
|
||||
lstrcpyW( src_root_buffer, src_root );
|
||||
|
||||
if (!hlist) hlist = hinf;
|
||||
if (!hinf) hinf = hlist;
|
||||
|
@ -826,13 +825,13 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
|
|||
params.SourcePath = NULL;
|
||||
params.SourceDescription = NULL;
|
||||
params.SourceTagfile = NULL;
|
||||
strcpyW( src_root_buffer, src_root );
|
||||
lstrcpyW( src_root_buffer, src_root );
|
||||
src_path[0] = 0;
|
||||
|
||||
if (!SetupGetStringFieldW( &context, 1, dst_file, ARRAY_SIZE( dst_file ), NULL ))
|
||||
goto end;
|
||||
if (!SetupGetStringFieldW( &context, 2, src_file, ARRAY_SIZE( src_file ), &len ) || len <= sizeof(WCHAR))
|
||||
strcpyW( src_file, dst_file );
|
||||
lstrcpyW( src_file, dst_file );
|
||||
|
||||
if (!SetupGetIntField( &context, 4, &flags )) flags = 0; /* FIXME */
|
||||
|
||||
|
@ -974,10 +973,10 @@ static BOOL create_full_pathW(const WCHAR *path)
|
|||
int len;
|
||||
WCHAR *new_path;
|
||||
|
||||
new_path = HeapAlloc(GetProcessHeap(), 0, (strlenW(path) + 1) * sizeof(WCHAR));
|
||||
strcpyW(new_path, path);
|
||||
new_path = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(path) + 1) * sizeof(WCHAR));
|
||||
lstrcpyW(new_path, path);
|
||||
|
||||
while((len = strlenW(new_path)) && new_path[len - 1] == '\\')
|
||||
while((len = lstrlenW(new_path)) && new_path[len - 1] == '\\')
|
||||
new_path[len - 1] = 0;
|
||||
|
||||
while(!CreateDirectoryW(new_path, NULL))
|
||||
|
@ -994,7 +993,7 @@ static BOOL create_full_pathW(const WCHAR *path)
|
|||
break;
|
||||
}
|
||||
|
||||
if(!(slash = strrchrW(new_path, '\\')))
|
||||
if(!(slash = wcsrchr(new_path, '\\')))
|
||||
{
|
||||
ret = FALSE;
|
||||
break;
|
||||
|
@ -1253,8 +1252,8 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
|
|||
|
||||
if ((dest_dir = get_destination_dir( hinf, NULL )))
|
||||
{
|
||||
strcpyW( dest_path, dest_dir );
|
||||
strcatW( dest_path, backslashW );
|
||||
lstrcpyW( dest_path, dest_dir );
|
||||
lstrcatW( dest_path, backslashW );
|
||||
heap_free( dest_dir );
|
||||
}
|
||||
}
|
||||
|
@ -1264,8 +1263,8 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
len = strlenW( source ) + 1;
|
||||
if (absolute) len += strlenW( root ) + 1;
|
||||
len = lstrlenW( source ) + 1;
|
||||
if (absolute) len += lstrlenW( root ) + 1;
|
||||
|
||||
if (!(p = buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
|
||||
{
|
||||
|
@ -1276,14 +1275,14 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
|
|||
|
||||
if (absolute)
|
||||
{
|
||||
strcpyW( buffer, root );
|
||||
p += strlenW( buffer );
|
||||
lstrcpyW( buffer, root );
|
||||
p += lstrlenW( buffer );
|
||||
if (p[-1] != '\\') *p++ = '\\';
|
||||
}
|
||||
while (*source == '\\') source++;
|
||||
strcpyW( p, source );
|
||||
lstrcpyW( p, source );
|
||||
|
||||
strcatW( dest_path, dest );
|
||||
lstrcatW( dest_path, dest );
|
||||
|
||||
ret = do_file_copyW( buffer, dest_path, style, handler, context );
|
||||
|
||||
|
@ -1414,8 +1413,8 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
|
|||
op->src_path = NULL;
|
||||
if (src_path)
|
||||
{
|
||||
strcatW(op->media->root, backslashW);
|
||||
strcatW(op->media->root, src_path);
|
||||
lstrcatW(op->media->root, backslashW);
|
||||
lstrcatW(op->media->root, src_path);
|
||||
}
|
||||
|
||||
for (;;)
|
||||
|
@ -1436,7 +1435,7 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
|
|||
else if (op_result == FILEOP_SKIP)
|
||||
break;
|
||||
else if (op_result == FILEOP_NEWPATH)
|
||||
strcpyW(op->media->root, newpath);
|
||||
lstrcpyW(op->media->root, newpath);
|
||||
else if (op_result != FILEOP_DOIT)
|
||||
FIXME("Unhandled return value %#x.\n", op_result);
|
||||
|
||||
|
@ -1453,8 +1452,8 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
|
|||
{
|
||||
if (src_path && !op->media->cabinet)
|
||||
{
|
||||
size_t root_len = strlenW(op->media->root), path_len = strlenW(src_path);
|
||||
if (path_len <= root_len && !strncmpiW(op->media->root + root_len - path_len, src_path, path_len))
|
||||
size_t root_len = lstrlenW(op->media->root), path_len = lstrlenW(src_path);
|
||||
if (path_len <= root_len && !wcsnicmp(op->media->root + root_len - path_len, src_path, path_len))
|
||||
op->media->root[root_len - path_len - 1] = 0;
|
||||
heap_free( src_path );
|
||||
}
|
||||
|
@ -1487,7 +1486,7 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
|
|||
goto done;
|
||||
else if (op_result == FILEOP_NEWPATH)
|
||||
{
|
||||
strcpyW(op->media->root, newpath);
|
||||
lstrcpyW(op->media->root, newpath);
|
||||
build_filepathsW(op, &paths);
|
||||
}
|
||||
else if (op_result != FILEOP_SKIP && op_result != FILEOP_DOIT)
|
||||
|
@ -1808,7 +1807,7 @@ UINT WINAPI SetupDefaultQueueCallbackW( PVOID context, UINT notification,
|
|||
{
|
||||
const SOURCE_MEDIA_W *media = (const SOURCE_MEDIA_W *)param1;
|
||||
TRACE( "need media %s %s\n", debugstr_w(media->SourcePath), debugstr_w(media->SourceFile) );
|
||||
strcpyW( (WCHAR *)param2, media->SourcePath );
|
||||
lstrcpyW( (WCHAR *)param2, media->SourcePath );
|
||||
return FILEOP_DOIT;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "setupapi.h"
|
||||
#include "setupapi_private.h"
|
||||
#include "fdi.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
/* from msvcrt */
|
||||
|
@ -462,7 +461,7 @@ static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
|
|||
if (err == FILEOP_DOIT) {
|
||||
TRACE(" Callback specified filename: %s\n", debugstr_w(fici.FullTargetName));
|
||||
if (fici.FullTargetName[0]) {
|
||||
len = strlenW(fici.FullTargetName) + 1;
|
||||
len = lstrlenW(fici.FullTargetName) + 1;
|
||||
if ((len > MAX_PATH ) || (len <= 1))
|
||||
return 0;
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, fici.FullTargetName, len, charbuf, MAX_PATH, 0, 0))
|
||||
|
@ -472,7 +471,7 @@ static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
|
|||
SetLastError(ERROR_PATH_NOT_FOUND);
|
||||
return -1;
|
||||
}
|
||||
strcpyW( phsc->most_recent_target, fici.FullTargetName );
|
||||
lstrcpyW( phsc->most_recent_target, fici.FullTargetName );
|
||||
return sc_cb_open(charbuf, _O_BINARY | _O_CREAT | _O_WRONLY, _S_IREAD | _S_IWRITE);
|
||||
} else {
|
||||
TRACE(" Callback skipped file.\n");
|
||||
|
@ -525,7 +524,7 @@ static INT_PTR CDECL sc_FNNOTIFY_W(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION p
|
|||
return -1;
|
||||
} else {
|
||||
if (mysterio[0]) {
|
||||
len = strlenW(mysterio) + 1;
|
||||
len = lstrlenW(mysterio) + 1;
|
||||
if ((len > 255) || (len <= 1))
|
||||
return 0;
|
||||
if (!WideCharToMultiByte(CP_ACP, 0, mysterio, len, pfdin->psz3, 255, 0, 0))
|
||||
|
@ -637,13 +636,13 @@ BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved,
|
|||
}
|
||||
|
||||
if (p) {
|
||||
strcpyW(my_hsc.most_recent_cabinet_name, p);
|
||||
lstrcpyW(my_hsc.most_recent_cabinet_name, p);
|
||||
*p = 0;
|
||||
len = WideCharToMultiByte(CP_ACP, 0, pszCabPathW, -1, pszCabPath,
|
||||
MAX_PATH, 0, 0);
|
||||
if (!len) return FALSE;
|
||||
} else {
|
||||
strcpyW(my_hsc.most_recent_cabinet_name, CabinetFile);
|
||||
lstrcpyW(my_hsc.most_recent_cabinet_name, CabinetFile);
|
||||
pszCabPath[0] = '\0';
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
|
@ -31,7 +29,6 @@
|
|||
#include "setupapi.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
||||
|
||||
|
@ -80,7 +77,7 @@ static inline DWORD get_string_hash(const WCHAR *str, BOOL case_sensitive)
|
|||
DWORD hash = 0;
|
||||
|
||||
while (*str) {
|
||||
WCHAR ch = case_sensitive ? *str : tolowerW(*str);
|
||||
WCHAR ch = case_sensitive ? *str : towlower(*str);
|
||||
hash += ch;
|
||||
if (ch & ~0xff)
|
||||
hash |= 1;
|
||||
|
@ -105,7 +102,7 @@ static inline char *get_extradata_ptr(struct stringtable *table, DWORD id)
|
|||
{
|
||||
WCHAR *ptrW = get_string_ptr(table, id);
|
||||
/* skip string itself */
|
||||
return (char*)(ptrW + strlenW(ptrW) + 1);
|
||||
return (char*)(ptrW + lstrlenW(ptrW) + 1);
|
||||
}
|
||||
|
||||
static inline BOOL is_valid_string_id(struct stringtable *table, DWORD id)
|
||||
|
@ -317,7 +314,7 @@ DWORD WINAPI StringTableLookUpStringEx(HSTRING_TABLE hTable, LPWSTR string, DWOR
|
|||
while (1) {
|
||||
entry = (struct stringentry*)(table->data + offset);
|
||||
if (case_sensitive)
|
||||
cmp = lstrcmpW(entry->data, string);
|
||||
cmp = wcscmp(entry->data, string);
|
||||
else
|
||||
cmp = lstrcmpiW(entry->data, string);
|
||||
if (!cmp) {
|
||||
|
@ -398,7 +395,7 @@ DWORD WINAPI StringTableAddStringEx(HSTRING_TABLE hTable, LPWSTR string,
|
|||
return id;
|
||||
|
||||
/* needed space for new record */
|
||||
len = sizeof(DWORD) + (strlenW(string)+1)*sizeof(WCHAR) + table->max_extra_size;
|
||||
len = sizeof(DWORD) + (lstrlenW(string)+1)*sizeof(WCHAR) + table->max_extra_size;
|
||||
if (table->nextoffset + len >= table->allocated) {
|
||||
table->allocated <<= 1;
|
||||
table->data = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, table->data, table->allocated);
|
||||
|
@ -422,9 +419,9 @@ DWORD WINAPI StringTableAddStringEx(HSTRING_TABLE hTable, LPWSTR string,
|
|||
|
||||
/* copy string */
|
||||
ptrW = get_string_ptr(table, id);
|
||||
strcpyW(ptrW, string);
|
||||
lstrcpyW(ptrW, string);
|
||||
if (!case_sensitive)
|
||||
strlwrW(ptrW);
|
||||
wcslwr(ptrW);
|
||||
|
||||
/* copy extra data */
|
||||
if (extra)
|
||||
|
@ -565,9 +562,9 @@ BOOL WINAPI StringTableStringFromIdEx(HSTRING_TABLE hTable, ULONG id, LPWSTR buf
|
|||
}
|
||||
|
||||
ptrW = get_string_ptr(table, id);
|
||||
len = (strlenW(ptrW) + 1)*sizeof(WCHAR);
|
||||
len = (lstrlenW(ptrW) + 1)*sizeof(WCHAR);
|
||||
if (len <= *buflen)
|
||||
strcpyW(buff, ptrW);
|
||||
lstrcpyW(buff, ptrW);
|
||||
else
|
||||
ret = FALSE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue