setupapi: Use wide character string literals.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2c4f5c0eab
commit
32a2cde6c1
|
@ -63,15 +63,6 @@ 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 */
|
||||
|
@ -200,7 +191,6 @@ static void extract_16bit_image( IMAGE_NT_HEADERS *nt, void **data, SIZE_T *size
|
|||
/* return 1 on success, 0 on nonexistent file, -1 on other error */
|
||||
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;
|
||||
|
@ -245,7 +235,7 @@ static int read_file( const WCHAR *name, void **data, SIZE_T *size, BOOL expect_
|
|||
st.st_size - header_size ) == st.st_size - header_size)
|
||||
{
|
||||
*data = file_buffer;
|
||||
if (lstrlenW(name) > 2 && !wcscmp( name + lstrlenW(name) - 2, sixteenW ))
|
||||
if (lstrlenW(name) > 2 && !wcscmp( name + lstrlenW(name) - 2, L"16" ))
|
||||
extract_16bit_image( nt, data, size );
|
||||
ret = 1;
|
||||
}
|
||||
|
@ -257,7 +247,6 @@ done:
|
|||
/* build a complete fake dll from scratch */
|
||||
static BOOL build_fake_dll( HANDLE file, const WCHAR *name )
|
||||
{
|
||||
static const WCHAR dotexeW[] = { '.','e','x','e',0 };
|
||||
IMAGE_DOS_HEADER *dos;
|
||||
IMAGE_NT_HEADERS *nt;
|
||||
struct dll_info info;
|
||||
|
@ -331,7 +320,7 @@ static BOOL build_fake_dll( HANDLE file, const WCHAR *name )
|
|||
nt->OptionalHeader.BaseOfCode = info.mem_pos;
|
||||
|
||||
ext = wcsrchr( name, '.' );
|
||||
if (!ext || wcsicmp( ext, dotexeW )) nt->FileHeader.Characteristics |= IMAGE_FILE_DLL;
|
||||
if (!ext || wcsicmp( ext, L".exe" )) nt->FileHeader.Characteristics |= IMAGE_FILE_DLL;
|
||||
|
||||
if (nt->FileHeader.Characteristics & IMAGE_FILE_DLL)
|
||||
{
|
||||
|
@ -405,14 +394,14 @@ static inline WCHAR *prepend( WCHAR *buffer, const WCHAR *str, size_t len )
|
|||
static const WCHAR *enum_load_path( unsigned int idx )
|
||||
{
|
||||
WCHAR buffer[32];
|
||||
swprintf( buffer, ARRAY_SIZE(buffer), winedlldirW, idx );
|
||||
swprintf( buffer, ARRAY_SIZE(buffer), L"WINEDLLDIR%u", idx );
|
||||
return _wgetenv( buffer );
|
||||
}
|
||||
|
||||
/* try to load a pre-compiled fake dll */
|
||||
static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
|
||||
{
|
||||
const WCHAR *build_dir = _wgetenv( winebuilddirW );
|
||||
const WCHAR *build_dir = _wgetenv( L"WINEBUILDDIR" );
|
||||
const WCHAR *path;
|
||||
WCHAR *file, *ptr;
|
||||
void *data = NULL;
|
||||
|
@ -424,13 +413,13 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
|
|||
|
||||
i = 0;
|
||||
len = lstrlenW( name );
|
||||
if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(programsW) + len + 1;
|
||||
if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(L"\\programs") + len + 1;
|
||||
while ((path = enum_load_path( i++ ))) maxlen = max( maxlen, lstrlenW(path) );
|
||||
maxlen += ARRAY_SIZE(fakedllsW) + len + ARRAY_SIZE(fakeW);
|
||||
maxlen += ARRAY_SIZE(L"\\fakedlls") + len + ARRAY_SIZE(L".fake");
|
||||
|
||||
if (!(file = HeapAlloc( GetProcessHeap(), 0, maxlen * sizeof(WCHAR) ))) return NULL;
|
||||
|
||||
pos = maxlen - len - ARRAY_SIZE(fakeW);
|
||||
pos = maxlen - len - ARRAY_SIZE(L".fake");
|
||||
lstrcpyW( file + pos, name );
|
||||
file[--pos] = '\\';
|
||||
|
||||
|
@ -440,24 +429,24 @@ 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 && !wcsncmp( ptr + namelen - 4, dllW, 4 )) namelen -= 4;
|
||||
if (namelen > 4 && !wcsncmp( ptr + namelen - 4, L".dll", 4 )) namelen -= 4;
|
||||
ptr = prepend( ptr, ptr, namelen );
|
||||
ptr = prepend( ptr, dllsW, ARRAY_SIZE(dllsW) - 1 );
|
||||
ptr = prepend( ptr, L"\\dlls", 5 );
|
||||
ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
|
||||
if ((res = read_file( ptr, &data, size, TRUE ))) goto done;
|
||||
lstrcpyW( file + pos + len + 1, fakeW );
|
||||
lstrcpyW( file + pos + len + 1, L".fake" );
|
||||
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 && !wcsncmp( ptr + namelen - 4, exeW, 4 )) namelen -= 4;
|
||||
if (namelen > 4 && !wcsncmp( ptr + namelen - 4, L".exe", 4 )) namelen -= 4;
|
||||
ptr = prepend( ptr, ptr, namelen );
|
||||
ptr = prepend( ptr, programsW, ARRAY_SIZE(programsW) - 1 );
|
||||
ptr = prepend( ptr, L"\\programs", 9 );
|
||||
ptr = prepend( ptr, build_dir, lstrlenW(build_dir) );
|
||||
if ((res = read_file( ptr, &data, size, TRUE ))) goto done;
|
||||
lstrcpyW( file + pos + len + 1, fakeW );
|
||||
lstrcpyW( file + pos + len + 1, L".fake" );
|
||||
if ((res = read_file( ptr, &data, size, FALSE ))) goto done;
|
||||
}
|
||||
|
||||
|
@ -466,7 +455,7 @@ static void *load_fake_dll( const WCHAR *name, SIZE_T *size )
|
|||
{
|
||||
ptr = prepend( file + pos, path, lstrlenW(path) );
|
||||
if ((res = read_file( ptr, &data, size, TRUE ))) break;
|
||||
ptr = prepend( file + pos, fakedllsW, ARRAY_SIZE(fakedllsW) - 1 );
|
||||
ptr = prepend( file + pos, L"\\fakedlls", 9 );
|
||||
ptr = prepend( ptr, path, lstrlenW(path) );
|
||||
if ((res = read_file( ptr, &data, size, FALSE ))) break;
|
||||
}
|
||||
|
@ -629,13 +618,12 @@ static BOOL next_xml_attr(xmlbuf_t* xmlbuf, xmlstr_t* name, xmlstr_t* value,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void get_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key,
|
||||
const xmlstr_t *version, const xmlstr_t *lang, WCHAR *buffer, DWORD size )
|
||||
static void append_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key,
|
||||
const xmlstr_t *version, const xmlstr_t *lang, WCHAR *buffer, DWORD size )
|
||||
{
|
||||
static const WCHAR trailerW[] = {'_','d','e','a','d','b','e','e','f',0};
|
||||
DWORD pos;
|
||||
DWORD pos = lstrlenW( buffer );
|
||||
|
||||
pos = MultiByteToWideChar( CP_UTF8, 0, arch->ptr, arch->len, buffer, size );
|
||||
pos += MultiByteToWideChar( CP_UTF8, 0, arch->ptr, arch->len, buffer + pos, size - pos );
|
||||
buffer[pos++] = '_';
|
||||
pos += MultiByteToWideChar( CP_UTF8, 0, name->ptr, name->len, buffer + pos, size - pos );
|
||||
buffer[pos++] = '_';
|
||||
|
@ -644,7 +632,7 @@ static void get_manifest_filename( const xmlstr_t *arch, const xmlstr_t *name, c
|
|||
pos += MultiByteToWideChar( CP_UTF8, 0, version->ptr, version->len, buffer + pos, size - pos );
|
||||
buffer[pos++] = '_';
|
||||
pos += MultiByteToWideChar( CP_UTF8, 0, lang->ptr, lang->len, buffer + pos, size - pos );
|
||||
memcpy( buffer + pos, trailerW, sizeof(trailerW) );
|
||||
lstrcpyW( buffer + pos, L"_deadbeef" );
|
||||
wcslwr( buffer );
|
||||
}
|
||||
|
||||
|
@ -652,28 +640,24 @@ static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, cons
|
|||
const xmlstr_t *key, const xmlstr_t *version, const xmlstr_t *lang,
|
||||
const void *dll_data, size_t dll_size )
|
||||
{
|
||||
static const WCHAR winsxsW[] = {'w','i','n','s','x','s','\\'};
|
||||
WCHAR *path;
|
||||
const WCHAR *filename;
|
||||
DWORD pos, written, path_len;
|
||||
DWORD written, path_len;
|
||||
HANDLE handle;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
if (!(filename = wcsrchr( dll_name, '\\' ))) filename = dll_name;
|
||||
else filename++;
|
||||
|
||||
path_len = GetWindowsDirectoryW( NULL, 0 ) + 1 + ARRAY_SIZE( winsxsW )
|
||||
path_len = GetWindowsDirectoryW( NULL, 0 ) + ARRAY_SIZE( L"\\winsxs\\" )
|
||||
+ 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 );
|
||||
path[pos++] = '\\';
|
||||
memcpy( path + pos, winsxsW, sizeof(winsxsW) );
|
||||
pos += ARRAY_SIZE( winsxsW );
|
||||
get_manifest_filename( arch, name, key, version, lang, path + pos, path_len - pos );
|
||||
pos += lstrlenW( path + pos );
|
||||
path[pos++] = '\\';
|
||||
lstrcpyW( path + pos, filename );
|
||||
GetWindowsDirectoryW( path, path_len );
|
||||
lstrcatW( path, L"\\winsxs\\" );
|
||||
append_manifest_filename( arch, name, key, version, lang, path, path_len );
|
||||
lstrcatW( path, L"\\" );
|
||||
lstrcatW( path, filename );
|
||||
handle = create_dest_file( path );
|
||||
if (handle && handle != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
@ -690,23 +674,19 @@ static BOOL create_winsxs_dll( const WCHAR *dll_name, const xmlstr_t *arch, cons
|
|||
static BOOL create_manifest( const xmlstr_t *arch, const xmlstr_t *name, const xmlstr_t *key,
|
||||
const xmlstr_t *version, const xmlstr_t *lang, const void *data, DWORD len )
|
||||
{
|
||||
static const WCHAR winsxsW[] = {'w','i','n','s','x','s','\\','m','a','n','i','f','e','s','t','s','\\'};
|
||||
static const WCHAR extensionW[] = {'.','m','a','n','i','f','e','s','t',0};
|
||||
WCHAR *path;
|
||||
DWORD pos, written, path_len;
|
||||
DWORD written, path_len;
|
||||
HANDLE handle;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
path_len = GetWindowsDirectoryW( NULL, 0 ) + 1 + ARRAY_SIZE( winsxsW )
|
||||
+ arch->len + name->len + key->len + version->len + 18 + ARRAY_SIZE( extensionW );
|
||||
path_len = GetWindowsDirectoryW( NULL, 0 ) + ARRAY_SIZE( L"\\winsxs\\manifests\\" )
|
||||
+ arch->len + name->len + key->len + version->len + 18 + ARRAY_SIZE( L".manifest" );
|
||||
|
||||
path = HeapAlloc( GetProcessHeap(), 0, path_len * sizeof(WCHAR) );
|
||||
pos = GetWindowsDirectoryW( path, MAX_PATH );
|
||||
path[pos++] = '\\';
|
||||
memcpy( path + pos, winsxsW, sizeof(winsxsW) );
|
||||
pos += ARRAY_SIZE( winsxsW );
|
||||
get_manifest_filename( arch, name, key, version, lang, path + pos, MAX_PATH - pos );
|
||||
lstrcatW( path + pos, extensionW );
|
||||
GetWindowsDirectoryW( path, path_len );
|
||||
lstrcatW( path, L"\\winsxs\\manifests\\" );
|
||||
append_manifest_filename( arch, name, key, version, lang, path, path_len );
|
||||
lstrcatW( path, L".manifest" );
|
||||
handle = CreateFileW( path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
|
||||
if (handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
|
@ -745,7 +725,6 @@ static BOOL CALLBACK register_manifest( HMODULE module, const WCHAR *type, WCHAR
|
|||
#else
|
||||
static const char current_arch[] = "none";
|
||||
#endif
|
||||
static const WCHAR manifestW[] = {'W','I','N','E','_','M','A','N','I','F','E','S','T'};
|
||||
const struct dll_data *dll_data = (const struct dll_data*)arg;
|
||||
xmlbuf_t buffer;
|
||||
xmlstr_t elem, attr_name, attr_value;
|
||||
|
@ -755,8 +734,7 @@ static BOOL CALLBACK register_manifest( HMODULE module, const WCHAR *type, WCHAR
|
|||
SIZE_T len;
|
||||
HRSRC rsrc;
|
||||
|
||||
if (IS_INTRESOURCE( res_name ) || wcsncmp( res_name, manifestW, ARRAY_SIZE( manifestW )))
|
||||
return TRUE;
|
||||
if (IS_INTRESOURCE( res_name ) || wcsncmp( res_name, L"WINE_MANIFEST", 13 )) return TRUE;
|
||||
|
||||
rsrc = FindResourceW( module, res_name, type );
|
||||
manifest = LoadResource( module, rsrc );
|
||||
|
@ -828,9 +806,6 @@ static BOOL CALLBACK register_resource( HMODULE module, LPCWSTR type, LPWSTR nam
|
|||
|
||||
static void register_fake_dll( const WCHAR *name, const void *data, size_t size )
|
||||
{
|
||||
static const WCHAR atlW[] = {'a','t','l','1','0','0','.','d','l','l',0};
|
||||
static const WCHAR moduleW[] = {'M','O','D','U','L','E',0};
|
||||
static const WCHAR regtypeW[] = {'W','I','N','E','_','R','E','G','I','S','T','R','Y',0};
|
||||
const IMAGE_RESOURCE_DIRECTORY *resdir;
|
||||
LDR_RESOURCE_INFO info;
|
||||
HRESULT hr = S_OK;
|
||||
|
@ -839,13 +814,13 @@ static void register_fake_dll( const WCHAR *name, const void *data, size_t size
|
|||
|
||||
EnumResourceNamesW( module, (WCHAR*)RT_MANIFEST, register_manifest, (LONG_PTR)&dll_data );
|
||||
|
||||
info.Type = (ULONG_PTR)regtypeW;
|
||||
info.Type = (ULONG_PTR)L"WINE_REGISTRY";
|
||||
if (LdrFindResourceDirectory_U( module, &info, 1, &resdir )) return;
|
||||
|
||||
if (!registrar)
|
||||
{
|
||||
HRESULT (WINAPI *pAtlCreateRegistrar)(IRegistrar**);
|
||||
HMODULE atl = LoadLibraryW( atlW );
|
||||
HMODULE atl = LoadLibraryW( L"atl100.dll" );
|
||||
|
||||
if ((pAtlCreateRegistrar = (void *)GetProcAddress( atl, "AtlCreateRegistrar" )))
|
||||
hr = pAtlCreateRegistrar( ®istrar );
|
||||
|
@ -861,15 +836,14 @@ static void register_fake_dll( const WCHAR *name, const void *data, size_t size
|
|||
|
||||
TRACE( "registering %s\n", debugstr_w(name) );
|
||||
IRegistrar_ClearReplacements( registrar );
|
||||
IRegistrar_AddReplacement( registrar, moduleW, name );
|
||||
EnumResourceNamesW( module, regtypeW, register_resource, (LONG_PTR)&hr );
|
||||
IRegistrar_AddReplacement( registrar, L"MODULE", name );
|
||||
EnumResourceNamesW( module, L"WINE_REGISTRY", register_resource, (LONG_PTR)&hr );
|
||||
if (FAILED(hr)) ERR( "failed to register %s: %x\n", debugstr_w(name), hr );
|
||||
}
|
||||
|
||||
/* copy a fake dll file to the dest directory */
|
||||
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;
|
||||
|
@ -881,7 +855,7 @@ static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL ex
|
|||
if (ext) lstrcpyW( end, ext );
|
||||
if (!(ret = read_file( file, &data, &size, expect_builtin ))) return 0;
|
||||
|
||||
if (end > name + 2 && !wcsncmp( end - 2, sixteenW, 2 )) end -= 2; /* remove "16" suffix */
|
||||
if (end > name + 2 && !wcsncmp( end - 2, L"16", 2 )) end -= 2; /* remove "16" suffix */
|
||||
memcpy( destname, name, (end - name) * sizeof(WCHAR) );
|
||||
destname[end - name] = 0;
|
||||
if (!add_handled_dll( destname )) ret = -1;
|
||||
|
@ -908,10 +882,6 @@ static int install_fake_dll( WCHAR *dest, WCHAR *file, const WCHAR *ext, BOOL ex
|
|||
/* find and install all fake dlls in a given lib directory */
|
||||
static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *default_ext, BOOL expect_builtin )
|
||||
{
|
||||
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;
|
||||
|
@ -919,22 +889,22 @@ static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *default_ext,
|
|||
file[1] = '\\'; /* change \??\ to \\?\ */
|
||||
name = file + lstrlenW(file);
|
||||
*name++ = '\\';
|
||||
lstrcpyW( name, starW );
|
||||
lstrcpyW( name, L"*" );
|
||||
|
||||
if ((handle = _wfindfirst( file, &data )) == -1) return;
|
||||
do
|
||||
{
|
||||
if (lstrlenW( data.name ) > max_dll_name_len) continue;
|
||||
if (!wcscmp( data.name, dotW )) continue;
|
||||
if (!wcscmp( data.name, dotdotW )) continue;
|
||||
if (!wcscmp( data.name, L"." )) continue;
|
||||
if (!wcscmp( data.name, L".." )) continue;
|
||||
lstrcpyW( name, data.name );
|
||||
if (default_ext) /* inside build dir */
|
||||
{
|
||||
lstrcatW( name, backslashW );
|
||||
lstrcatW( name, L"\\" );
|
||||
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 );
|
||||
install_fake_dll( dest, file, L".fake", FALSE );
|
||||
}
|
||||
else install_fake_dll( dest, file, NULL, expect_builtin );
|
||||
}
|
||||
|
@ -945,12 +915,12 @@ static void install_lib_dir( WCHAR *dest, WCHAR *file, const WCHAR *default_ext,
|
|||
/* create fake dlls in dirname for all the files we can find */
|
||||
static BOOL create_wildcard_dlls( const WCHAR *dirname )
|
||||
{
|
||||
const WCHAR *build_dir = _wgetenv( winebuilddirW );
|
||||
const WCHAR *build_dir = _wgetenv( L"WINEBUILDDIR" );
|
||||
const WCHAR *path;
|
||||
unsigned int i, maxlen = 0;
|
||||
WCHAR *file, *dest;
|
||||
|
||||
if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(programsW) + 1;
|
||||
if (build_dir) maxlen = lstrlenW(build_dir) + ARRAY_SIZE(L"\\programs") + 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;
|
||||
|
@ -966,18 +936,18 @@ static BOOL create_wildcard_dlls( const WCHAR *dirname )
|
|||
if (build_dir)
|
||||
{
|
||||
lstrcpyW( file, build_dir );
|
||||
lstrcatW( file, dllsW );
|
||||
install_lib_dir( dest, file, dllW, TRUE );
|
||||
lstrcatW( file, L"\\dlls" );
|
||||
install_lib_dir( dest, file, L".dll", TRUE );
|
||||
lstrcpyW( file, build_dir );
|
||||
lstrcatW( file, programsW );
|
||||
install_lib_dir( dest, file, exeW, TRUE );
|
||||
lstrcatW( file, L"\\programs" );
|
||||
install_lib_dir( dest, file, L".exe", TRUE );
|
||||
}
|
||||
for (i = 0; (path = enum_load_path( i )); i++)
|
||||
{
|
||||
lstrcpyW( file, path );
|
||||
install_lib_dir( dest, file, NULL, TRUE );
|
||||
lstrcpyW( file, path );
|
||||
lstrcatW( file, fakedllsW );
|
||||
lstrcatW( file, L"\\fakedlls" );
|
||||
install_lib_dir( dest, file, NULL, FALSE );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, file );
|
||||
|
|
|
@ -69,40 +69,6 @@ struct register_dll_info
|
|||
|
||||
typedef BOOL (*iterate_fields_func)( HINF hinf, PCWSTR field, void *arg );
|
||||
|
||||
/* Unicode constants */
|
||||
static const WCHAR CopyFiles[] = {'C','o','p','y','F','i','l','e','s',0};
|
||||
static const WCHAR DelFiles[] = {'D','e','l','F','i','l','e','s',0};
|
||||
static const WCHAR RenFiles[] = {'R','e','n','F','i','l','e','s',0};
|
||||
static const WCHAR Ini2Reg[] = {'I','n','i','2','R','e','g',0};
|
||||
static const WCHAR LogConf[] = {'L','o','g','C','o','n','f',0};
|
||||
static const WCHAR AddReg[] = {'A','d','d','R','e','g',0};
|
||||
static const WCHAR DelReg[] = {'D','e','l','R','e','g',0};
|
||||
static const WCHAR BitReg[] = {'B','i','t','R','e','g',0};
|
||||
static const WCHAR UpdateInis[] = {'U','p','d','a','t','e','I','n','i','s',0};
|
||||
static const WCHAR CopyINF[] = {'C','o','p','y','I','N','F',0};
|
||||
static const WCHAR AddService[] = {'A','d','d','S','e','r','v','i','c','e',0};
|
||||
static const WCHAR DelService[] = {'D','e','l','S','e','r','v','i','c','e',0};
|
||||
static const WCHAR UpdateIniFields[] = {'U','p','d','a','t','e','I','n','i','F','i','e','l','d','s',0};
|
||||
static const WCHAR RegisterDlls[] = {'R','e','g','i','s','t','e','r','D','l','l','s',0};
|
||||
static const WCHAR UnregisterDlls[] = {'U','n','r','e','g','i','s','t','e','r','D','l','l','s',0};
|
||||
static const WCHAR ProfileItems[] = {'P','r','o','f','i','l','e','I','t','e','m','s',0};
|
||||
static const WCHAR Name[] = {'N','a','m','e',0};
|
||||
static const WCHAR CmdLine[] = {'C','m','d','L','i','n','e',0};
|
||||
static const WCHAR SubDir[] = {'S','u','b','D','i','r',0};
|
||||
static const WCHAR WineFakeDlls[] = {'W','i','n','e','F','a','k','e','D','l','l','s',0};
|
||||
static const WCHAR WinePreInstall[] = {'W','i','n','e','P','r','e','I','n','s','t','a','l','l',0};
|
||||
static const WCHAR DisplayName[] = {'D','i','s','p','l','a','y','N','a','m','e',0};
|
||||
static const WCHAR Description[] = {'D','e','s','c','r','i','p','t','i','o','n',0};
|
||||
static const WCHAR ServiceBinary[] = {'S','e','r','v','i','c','e','B','i','n','a','r','y',0};
|
||||
static const WCHAR StartName[] = {'S','t','a','r','t','N','a','m','e',0};
|
||||
static const WCHAR LoadOrderGroup[] = {'L','o','a','d','O','r','d','e','r','G','r','o','u','p',0};
|
||||
static const WCHAR ServiceType[] = {'S','e','r','v','i','c','e','T','y','p','e',0};
|
||||
static const WCHAR StartType[] = {'S','t','a','r','t','T','y','p','e',0};
|
||||
static const WCHAR ErrorControl[] = {'E','r','r','o','r','C','o','n','t','r','o','l',0};
|
||||
|
||||
static const WCHAR ServicesKey[] = {'S','y','s','t','e','m','\\',
|
||||
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\',
|
||||
'S','e','r','v','i','c','e','s',0};
|
||||
|
||||
/***********************************************************************
|
||||
* get_field_string
|
||||
|
@ -205,17 +171,11 @@ static BOOL rename_files_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
*/
|
||||
static HKEY get_root_key( const WCHAR *name, HKEY def_root )
|
||||
{
|
||||
static const WCHAR HKCR[] = {'H','K','C','R',0};
|
||||
static const WCHAR HKCU[] = {'H','K','C','U',0};
|
||||
static const WCHAR HKLM[] = {'H','K','L','M',0};
|
||||
static const WCHAR HKU[] = {'H','K','U',0};
|
||||
static const WCHAR HKR[] = {'H','K','R',0};
|
||||
|
||||
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;
|
||||
if (!wcsicmp( name, L"HKCR" )) return HKEY_CLASSES_ROOT;
|
||||
if (!wcsicmp( name, L"HKCU" )) return HKEY_CURRENT_USER;
|
||||
if (!wcsicmp( name, L"HKLM" )) return HKEY_LOCAL_MACHINE;
|
||||
if (!wcsicmp( name, L"HKU" )) return HKEY_USERS;
|
||||
if (!wcsicmp( name, L"HKR" )) return def_root;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -359,7 +319,6 @@ static BOOL do_reg_operation( HKEY hkey, const WCHAR *value, INFCONTEXT *context
|
|||
if (!(flags & FLG_ADDREG_BINVALUETYPE) ||
|
||||
(type == REG_DWORD && SetupGetFieldCount(context) == 5))
|
||||
{
|
||||
static const WCHAR empty;
|
||||
WCHAR *str = NULL;
|
||||
|
||||
if (type == REG_MULTI_SZ)
|
||||
|
@ -400,7 +359,7 @@ static BOOL do_reg_operation( HKEY hkey, const WCHAR *value, INFCONTEXT *context
|
|||
{
|
||||
TRACE( "setting value %s to %s\n", debugstr_w(value), debugstr_w(str) );
|
||||
if (str) RegSetValueExW( hkey, value, 0, type, (BYTE *)str, size * sizeof(WCHAR) );
|
||||
else RegSetValueExW( hkey, value, 0, type, (const BYTE *)&empty, sizeof(WCHAR) );
|
||||
else RegSetValueExW( hkey, value, 0, type, (const BYTE *)L"", sizeof(WCHAR) );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, str );
|
||||
return TRUE;
|
||||
|
@ -552,15 +511,13 @@ static BOOL do_register_dll( struct register_dll_info *info, const WCHAR *path,
|
|||
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;
|
||||
if (!args) args = L"/RegServer";
|
||||
len = lstrlenW(path) + lstrlenW(args) + 4;
|
||||
cmd_line = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
|
||||
swprintf( cmd_line, len, format, path, args );
|
||||
swprintf( cmd_line, len, L"\"%s\" %s", path, args );
|
||||
memset( &startup, 0, sizeof(startup) );
|
||||
startup.cb = sizeof(startup);
|
||||
TRACE( "executing %s\n", debugstr_w(cmd_line) );
|
||||
|
@ -831,11 +788,9 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
INFCONTEXT name_context, context;
|
||||
int attrs=0;
|
||||
|
||||
static const WCHAR dotlnk[] = {'.','l','n','k',0};
|
||||
|
||||
TRACE( "(%s)\n", debugstr_w(field) );
|
||||
|
||||
if (SetupFindFirstLineW( hinf, field, Name, &name_context ))
|
||||
if (SetupFindFirstLineW( hinf, field, L"Name", &name_context ))
|
||||
{
|
||||
SetupGetIntField( &name_context, 2, &attrs );
|
||||
if (attrs & ~FLG_PROFITEM_GROUP) FIXME( "unhandled attributes: %x\n", attrs );
|
||||
|
@ -847,7 +802,7 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
lnkpath_end = lnkpath + lstrlenW(lnkpath);
|
||||
if (lnkpath_end[-1] != '\\') *lnkpath_end++ = '\\';
|
||||
|
||||
if (!(attrs & FLG_PROFITEM_GROUP) && SetupFindFirstLineW( hinf, field, SubDir, &context ))
|
||||
if (!(attrs & FLG_PROFITEM_GROUP) && SetupFindFirstLineW( hinf, field, L"SubDir", &context ))
|
||||
{
|
||||
unsigned int subdir_size;
|
||||
|
||||
|
@ -874,12 +829,12 @@ static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg )
|
|||
HRESULT initresult=E_FAIL;
|
||||
|
||||
if (lnkpath+MAX_PATH < lnkpath_end + 5) return TRUE;
|
||||
lstrcpyW( lnkpath_end, dotlnk );
|
||||
lstrcpyW( lnkpath_end, L".lnk" );
|
||||
|
||||
TRACE( "link path: %s\n", debugstr_w(lnkpath) );
|
||||
|
||||
/* calculate command line */
|
||||
if (SetupFindFirstLineW( hinf, field, CmdLine, &context ))
|
||||
if (SetupFindFirstLineW( hinf, field, L"CmdLine", &context ))
|
||||
{
|
||||
unsigned int dir_len=0, subdir_size=0, filename_size=0;
|
||||
int dirid=0;
|
||||
|
@ -1029,7 +984,7 @@ BOOL WINAPI SetupInstallFilesFromInfSectionW( HINF hinf, HINF hlayout, HSPFILEQ
|
|||
info.src_root = src_root;
|
||||
info.copy_flags = flags;
|
||||
info.layout = hlayout;
|
||||
return iterate_section_fields( hinf, section, CopyFiles, copy_files_callback, &info );
|
||||
return iterate_section_fields( hinf, section, L"CopyFiles", copy_files_callback, &info );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1085,7 +1040,7 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
|
|||
|
||||
info.default_root = key_root;
|
||||
info.delete = FALSE;
|
||||
if (!iterate_section_fields( hinf, section, WinePreInstall, registry_callback, &info ))
|
||||
if (!iterate_section_fields( hinf, section, L"WinePreInstall", registry_callback, &info ))
|
||||
return FALSE;
|
||||
}
|
||||
if (flags & SPINST_FILES)
|
||||
|
@ -1098,28 +1053,28 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
|
|||
info.src_root = src_root;
|
||||
info.copy_flags = copy_flags;
|
||||
info.layout = hinf;
|
||||
ret = (iterate_section_fields( hinf, section, CopyFiles, copy_files_callback, &info ) &&
|
||||
iterate_section_fields( hinf, section, DelFiles, delete_files_callback, &info ) &&
|
||||
iterate_section_fields( hinf, section, RenFiles, rename_files_callback, &info ) &&
|
||||
ret = (iterate_section_fields( hinf, section, L"CopyFiles", copy_files_callback, &info ) &&
|
||||
iterate_section_fields( hinf, section, L"DelFiles", delete_files_callback, &info ) &&
|
||||
iterate_section_fields( hinf, section, L"RenFiles", rename_files_callback, &info ) &&
|
||||
SetupCommitFileQueueW( owner, queue, callback, context ));
|
||||
SetupCloseFileQueue( queue );
|
||||
if (!ret) return FALSE;
|
||||
}
|
||||
if (flags & SPINST_INIFILES)
|
||||
{
|
||||
if (!iterate_section_fields( hinf, section, UpdateInis, update_ini_callback, NULL ) ||
|
||||
!iterate_section_fields( hinf, section, UpdateIniFields,
|
||||
if (!iterate_section_fields( hinf, section, L"UpdateInis", update_ini_callback, NULL ) ||
|
||||
!iterate_section_fields( hinf, section, L"UpdateIniFields",
|
||||
update_ini_fields_callback, NULL ))
|
||||
return FALSE;
|
||||
}
|
||||
if (flags & SPINST_INI2REG)
|
||||
{
|
||||
if (!iterate_section_fields( hinf, section, Ini2Reg, ini2reg_callback, NULL ))
|
||||
if (!iterate_section_fields( hinf, section, L"Ini2Reg", ini2reg_callback, NULL ))
|
||||
return FALSE;
|
||||
}
|
||||
if (flags & SPINST_LOGCONFIG)
|
||||
{
|
||||
if (!iterate_section_fields( hinf, section, LogConf, logconf_callback, NULL ))
|
||||
if (!iterate_section_fields( hinf, section, L"LogConf", logconf_callback, NULL ))
|
||||
return FALSE;
|
||||
}
|
||||
if (flags & SPINST_REGSVR)
|
||||
|
@ -1138,14 +1093,14 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
|
|||
}
|
||||
else info.callback = NULL;
|
||||
|
||||
if (iterate_section_fields( hinf, section, WineFakeDlls, fake_dlls_callback, NULL ))
|
||||
if (iterate_section_fields( hinf, section, L"WineFakeDlls", fake_dlls_callback, NULL ))
|
||||
cleanup_fake_dlls();
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
hr = CoInitialize(NULL);
|
||||
|
||||
ret = iterate_section_fields( hinf, section, RegisterDlls, register_dlls_callback, &info );
|
||||
ret = iterate_section_fields( hinf, section, L"RegisterDlls", register_dlls_callback, &info );
|
||||
for (i = 0; i < info.modules_count; i++) FreeLibrary( info.modules[i] );
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
|
@ -1172,7 +1127,7 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
|
|||
|
||||
hr = CoInitialize(NULL);
|
||||
|
||||
ret = iterate_section_fields( hinf, section, UnregisterDlls, register_dlls_callback, &info );
|
||||
ret = iterate_section_fields( hinf, section, L"UnregisterDlls", register_dlls_callback, &info );
|
||||
for (i = 0; i < info.modules_count; i++) FreeLibrary( info.modules[i] );
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
|
@ -1187,25 +1142,25 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
|
|||
|
||||
info.default_root = key_root;
|
||||
info.delete = TRUE;
|
||||
if (!iterate_section_fields( hinf, section, DelReg, registry_callback, &info ))
|
||||
if (!iterate_section_fields( hinf, section, L"DelReg", registry_callback, &info ))
|
||||
return FALSE;
|
||||
info.delete = FALSE;
|
||||
if (!iterate_section_fields( hinf, section, AddReg, registry_callback, &info ))
|
||||
if (!iterate_section_fields( hinf, section, L"AddReg", registry_callback, &info ))
|
||||
return FALSE;
|
||||
}
|
||||
if (flags & SPINST_BITREG)
|
||||
{
|
||||
if (!iterate_section_fields( hinf, section, BitReg, bitreg_callback, NULL ))
|
||||
if (!iterate_section_fields( hinf, section, L"BitReg", bitreg_callback, NULL ))
|
||||
return FALSE;
|
||||
}
|
||||
if (flags & SPINST_PROFILEITEMS)
|
||||
{
|
||||
if (!iterate_section_fields( hinf, section, ProfileItems, profile_items_callback, NULL ))
|
||||
if (!iterate_section_fields( hinf, section, L"ProfileItems", profile_items_callback, NULL ))
|
||||
return FALSE;
|
||||
}
|
||||
if (flags & SPINST_COPYINF)
|
||||
{
|
||||
if (!iterate_section_fields( hinf, section, CopyINF, copy_inf_callback, NULL ))
|
||||
if (!iterate_section_fields( hinf, section, L"CopyINF", copy_inf_callback, NULL ))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1223,20 +1178,18 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
|
|||
void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show )
|
||||
{
|
||||
#ifdef __i386__
|
||||
static const WCHAR nt_platformW[] = {'.','n','t','x','8','6',0};
|
||||
static const WCHAR nt_platformW[] = L".ntx86";
|
||||
#elif defined(__x86_64__)
|
||||
static const WCHAR nt_platformW[] = {'.','n','t','a','m','d','6','4',0};
|
||||
static const WCHAR nt_platformW[] = L".ntamd64";
|
||||
#elif defined(__arm__)
|
||||
static const WCHAR nt_platformW[] = {'.','n','t','a','r','m',0};
|
||||
static const WCHAR nt_platformW[] = L".ntarm";
|
||||
#elif defined(__aarch64__)
|
||||
static const WCHAR nt_platformW[] = {'.','n','t','a','r','m','6','4',0};
|
||||
static const WCHAR nt_platformW[] = L".ntarm64";
|
||||
#else /* FIXME: other platforms */
|
||||
static const WCHAR nt_platformW[] = {'.','n','t',0};
|
||||
static const WCHAR nt_platformW[] = L".nt";
|
||||
#endif
|
||||
static const WCHAR nt_genericW[] = {'.','n','t',0};
|
||||
static const WCHAR servicesW[] = {'.','S','e','r','v','i','c','e','s',0};
|
||||
|
||||
WCHAR *s, *path, section[MAX_PATH + ARRAY_SIZE( nt_platformW ) + ARRAY_SIZE( servicesW )];
|
||||
WCHAR *s, *path, section[MAX_PATH + ARRAY_SIZE( nt_platformW ) + ARRAY_SIZE( L".Services" )];
|
||||
void *callback_context;
|
||||
UINT mode;
|
||||
HINF hinf;
|
||||
|
@ -1265,10 +1218,10 @@ 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 + lstrlenW(section);
|
||||
memcpy( s, nt_platformW, sizeof(nt_platformW) );
|
||||
lstrcpyW( s, nt_platformW );
|
||||
if (!(SetupFindFirstLineW( hinf, section, NULL, &context )))
|
||||
{
|
||||
memcpy( s, nt_genericW, sizeof(nt_genericW) );
|
||||
lstrcpyW( s, L".nt" );
|
||||
if (!(SetupFindFirstLineW( hinf, section, NULL, &context ))) *s = 0;
|
||||
}
|
||||
if (*s) TRACE( "using section %s instead\n", debugstr_w(section) );
|
||||
|
@ -1279,7 +1232,7 @@ void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, I
|
|||
SetupDefaultQueueCallbackW, callback_context,
|
||||
NULL, NULL );
|
||||
SetupTermDefaultQueueCallback( callback_context );
|
||||
lstrcatW( section, servicesW );
|
||||
lstrcatW( section, L".Services" );
|
||||
SetupInstallServicesFromInfSectionW( hinf, section, 0 );
|
||||
SetupCloseInfFile( hinf );
|
||||
|
||||
|
@ -1323,25 +1276,25 @@ static BOOL add_service( SC_HANDLE scm, HINF hinf, const WCHAR *name, const WCHA
|
|||
|
||||
/* first the mandatory fields */
|
||||
|
||||
if (!SetupFindFirstLineW( hinf, section, ServiceType, &context ) ||
|
||||
if (!SetupFindFirstLineW( hinf, section, L"ServiceType", &context ) ||
|
||||
!SetupGetIntField( &context, 1, &service_type ))
|
||||
{
|
||||
SetLastError( ERROR_BAD_SERVICE_INSTALLSECT );
|
||||
return FALSE;
|
||||
}
|
||||
if (!SetupFindFirstLineW( hinf, section, StartType, &context ) ||
|
||||
if (!SetupFindFirstLineW( hinf, section, L"StartType", &context ) ||
|
||||
!SetupGetIntField( &context, 1, &start_type ))
|
||||
{
|
||||
SetLastError( ERROR_BAD_SERVICE_INSTALLSECT );
|
||||
return FALSE;
|
||||
}
|
||||
if (!SetupFindFirstLineW( hinf, section, ErrorControl, &context ) ||
|
||||
if (!SetupFindFirstLineW( hinf, section, L"ErrorControl", &context ) ||
|
||||
!SetupGetIntField( &context, 1, &error_control ))
|
||||
{
|
||||
SetLastError( ERROR_BAD_SERVICE_INSTALLSECT );
|
||||
return FALSE;
|
||||
}
|
||||
if (!(binary_path = dup_section_line_field( hinf, section, ServiceBinary, 1 )))
|
||||
if (!(binary_path = dup_section_line_field( hinf, section, L"ServiceBinary", 1 )))
|
||||
{
|
||||
SetLastError( ERROR_BAD_SERVICE_INSTALLSECT );
|
||||
return FALSE;
|
||||
|
@ -1349,10 +1302,10 @@ static BOOL add_service( SC_HANDLE scm, HINF hinf, const WCHAR *name, const WCHA
|
|||
|
||||
/* now the optional fields */
|
||||
|
||||
display_name = dup_section_line_field( hinf, section, DisplayName, 1 );
|
||||
start_name = dup_section_line_field( hinf, section, StartName, 1 );
|
||||
load_order = dup_section_line_field( hinf, section, LoadOrderGroup, 1 );
|
||||
descr.lpDescription = dup_section_line_field( hinf, section, Description, 1 );
|
||||
display_name = dup_section_line_field( hinf, section, L"DisplayName", 1 );
|
||||
start_name = dup_section_line_field( hinf, section, L"StartName", 1 );
|
||||
load_order = dup_section_line_field( hinf, section, L"LoadOrderGroup", 1 );
|
||||
descr.lpDescription = dup_section_line_field( hinf, section, L"Description", 1 );
|
||||
|
||||
/* FIXME: Dependencies field */
|
||||
/* FIXME: Security field */
|
||||
|
@ -1413,7 +1366,7 @@ static BOOL add_service( SC_HANDLE scm, HINF hinf, const WCHAR *name, const WCHA
|
|||
/* execute the AddReg, DelReg and BitReg entries */
|
||||
|
||||
info.default_root = 0;
|
||||
if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, ServicesKey, &hkey ))
|
||||
if (!RegOpenKeyW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Services", &hkey ))
|
||||
{
|
||||
RegOpenKeyW( hkey, name, &info.default_root );
|
||||
RegCloseKey( hkey );
|
||||
|
@ -1421,12 +1374,12 @@ static BOOL add_service( SC_HANDLE scm, HINF hinf, const WCHAR *name, const WCHA
|
|||
if (info.default_root)
|
||||
{
|
||||
info.delete = TRUE;
|
||||
iterate_section_fields( hinf, section, DelReg, registry_callback, &info );
|
||||
iterate_section_fields( hinf, section, L"DelReg", registry_callback, &info );
|
||||
info.delete = FALSE;
|
||||
iterate_section_fields( hinf, section, AddReg, registry_callback, &info );
|
||||
iterate_section_fields( hinf, section, L"AddReg", registry_callback, &info );
|
||||
RegCloseKey( info.default_root );
|
||||
}
|
||||
iterate_section_fields( hinf, section, BitReg, bitreg_callback, NULL );
|
||||
iterate_section_fields( hinf, section, L"BitReg", bitreg_callback, NULL );
|
||||
|
||||
if (flags & SPSVCINST_STARTSERVICE) StartServiceW( service, 0, NULL );
|
||||
CloseServiceHandle( service );
|
||||
|
@ -1486,7 +1439,7 @@ BOOL WINAPI SetupInstallServicesFromInfSectionW( HINF hinf, PCWSTR section, DWOR
|
|||
}
|
||||
if (!(scm = OpenSCManagerW( NULL, NULL, SC_MANAGER_ALL_ACCESS ))) return FALSE;
|
||||
|
||||
if (SetupFindFirstLineW( hinf, section, AddService, &context ))
|
||||
if (SetupFindFirstLineW( hinf, section, L"AddService", &context ))
|
||||
{
|
||||
do
|
||||
{
|
||||
|
@ -1497,10 +1450,10 @@ BOOL WINAPI SetupInstallServicesFromInfSectionW( HINF hinf, PCWSTR section, DWOR
|
|||
continue;
|
||||
if (!(ret = add_service( scm, hinf, service_name, service_section, section_flags | flags )))
|
||||
goto done;
|
||||
} while (SetupFindNextMatchLineW( &context, AddService, &context ));
|
||||
} while (SetupFindNextMatchLineW( &context, L"AddService", &context ));
|
||||
}
|
||||
|
||||
if (SetupFindFirstLineW( hinf, section, DelService, &context ))
|
||||
if (SetupFindFirstLineW( hinf, section, L"DelService", &context ))
|
||||
{
|
||||
do
|
||||
{
|
||||
|
@ -1508,7 +1461,7 @@ BOOL WINAPI SetupInstallServicesFromInfSectionW( HINF hinf, PCWSTR section, DWOR
|
|||
continue;
|
||||
if (!SetupGetIntField( &context, 2, §ion_flags )) section_flags = 0;
|
||||
if (!(ret = del_service( scm, hinf, service_name, section_flags | flags ))) goto done;
|
||||
} while (SetupFindNextMatchLineW( &context, AddService, &context ));
|
||||
} while (SetupFindNextMatchLineW( &context, L"AddService", &context ));
|
||||
}
|
||||
if (ret) SetLastError( ERROR_SUCCESS );
|
||||
done:
|
||||
|
@ -1577,7 +1530,6 @@ BOOL WINAPI SetupGetInfFileListA(PCSTR dir, DWORD style, PSTR buffer,
|
|||
BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
||||
DWORD insize, PDWORD outsize)
|
||||
{
|
||||
static const WCHAR inf[] = {'\\','*','.','i','n','f',0 };
|
||||
WCHAR *filter, *fullname = NULL, *ptr = buffer;
|
||||
DWORD dir_len, name_len = 20, size ;
|
||||
WIN32_FIND_DATAW finddata;
|
||||
|
@ -1628,7 +1580,6 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
}
|
||||
else
|
||||
{
|
||||
static const WCHAR infdir[] = {'\\','i','n','f',0};
|
||||
DWORD msize;
|
||||
dir_len = GetWindowsDirectoryW( NULL, 0 );
|
||||
msize = ( 7 + 4 + dir_len ) * sizeof( WCHAR );
|
||||
|
@ -1639,9 +1590,9 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
return FALSE;
|
||||
}
|
||||
GetWindowsDirectoryW( filter, msize );
|
||||
lstrcatW( filter, infdir );
|
||||
lstrcatW( filter, L"\\inf" );
|
||||
}
|
||||
lstrcatW( filter, inf );
|
||||
lstrcatW( filter, L"\\*.inf" );
|
||||
|
||||
hdl = FindFirstFileW( filter , &finddata );
|
||||
if ( hdl == INVALID_HANDLE_VALUE )
|
||||
|
@ -1653,14 +1604,6 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
size = 1;
|
||||
do
|
||||
{
|
||||
static const WCHAR key[] =
|
||||
{'S','i','g','n','a','t','u','r','e',0 };
|
||||
static const WCHAR section[] =
|
||||
{'V','e','r','s','i','o','n',0 };
|
||||
static const WCHAR sig_win4_1[] =
|
||||
{'$','C','h','i','c','a','g','o','$',0 };
|
||||
static const WCHAR sig_win4_2[] =
|
||||
{'$','W','I','N','D','O','W','S',' ','N','T','$',0 };
|
||||
WCHAR signature[ MAX_PATH ];
|
||||
BOOL valid = FALSE;
|
||||
DWORD len = lstrlenW( finddata.cFileName );
|
||||
|
@ -1681,14 +1624,13 @@ BOOL WINAPI SetupGetInfFileListW(PCWSTR dir, DWORD style, PWSTR buffer,
|
|||
}
|
||||
fullname[ dir_len + 1] = 0; /* keep '\\' */
|
||||
lstrcatW( fullname, finddata.cFileName );
|
||||
if (!GetPrivateProfileStringW( section, key, NULL, signature, MAX_PATH, fullname ))
|
||||
if (!GetPrivateProfileStringW( L"Version", L"Signature", NULL, signature, MAX_PATH, fullname ))
|
||||
signature[0] = 0;
|
||||
if( INF_STYLE_OLDNT & style )
|
||||
valid = wcsicmp( sig_win4_1, signature ) &&
|
||||
wcsicmp( sig_win4_2, signature );
|
||||
valid = wcsicmp( L"$Chicago$", signature ) && wcsicmp( L"$WINDOWS NT$", signature );
|
||||
if( INF_STYLE_WIN4 & style )
|
||||
valid = valid || !wcsicmp( sig_win4_1, signature ) ||
|
||||
!wcsicmp( sig_win4_2, signature );
|
||||
valid = valid || !wcsicmp( L"$Chicago$", signature ) ||
|
||||
!wcsicmp( L"$WINDOWS NT$", signature );
|
||||
if( valid )
|
||||
{
|
||||
size += 1 + lstrlenW( finddata.cFileName );
|
||||
|
|
|
@ -36,8 +36,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
|
||||
|
||||
static const WCHAR backslashW[] = {'\\',0};
|
||||
|
||||
/* context structure for the default queue callback */
|
||||
struct default_callback_context
|
||||
{
|
||||
|
@ -289,21 +287,16 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification,
|
|||
static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARAMS_W *params,
|
||||
WCHAR *src_root, WCHAR *src_path)
|
||||
{
|
||||
static const WCHAR SourceDisksNames[] =
|
||||
{'S','o','u','r','c','e','D','i','s','k','s','N','a','m','e','s',0};
|
||||
static const WCHAR SourceDisksFiles[] =
|
||||
{'S','o','u','r','c','e','D','i','s','k','s','F','i','l','e','s',0};
|
||||
|
||||
INFCONTEXT file_ctx, disk_ctx;
|
||||
INT id, diskid;
|
||||
DWORD len;
|
||||
|
||||
/* find the SourceDisksFiles entry */
|
||||
if (!SetupFindFirstLineW( hinf, SourceDisksFiles, src_file, &file_ctx )) return;
|
||||
if (!SetupFindFirstLineW( hinf, L"SourceDisksFiles", src_file, &file_ctx )) return;
|
||||
if (!SetupGetIntField( &file_ctx, 1, &diskid )) return;
|
||||
|
||||
/* now find the diskid in the SourceDisksNames section */
|
||||
if (!SetupFindFirstLineW( hinf, SourceDisksNames, NULL, &disk_ctx )) return;
|
||||
if (!SetupFindFirstLineW( hinf, L"SourceDisksNames", NULL, &disk_ctx )) return;
|
||||
for (;;)
|
||||
{
|
||||
if (SetupGetIntField( &disk_ctx, 0, &id ) && (id == diskid)) break;
|
||||
|
@ -321,7 +314,7 @@ static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARA
|
|||
if (SetupGetStringFieldW( &disk_ctx, 4, NULL, 0, &len ) && len > sizeof(WCHAR)
|
||||
&& len < MAX_PATH - lstrlenW( src_root ) - 1)
|
||||
{
|
||||
lstrcatW( src_root, backslashW );
|
||||
lstrcatW( src_root, L"\\" );
|
||||
SetupGetStringFieldW( &disk_ctx, 4, src_root + lstrlenW( src_root ),
|
||||
MAX_PATH - lstrlenW( src_root ), NULL );
|
||||
}
|
||||
|
@ -340,14 +333,12 @@ static void get_source_info( HINF hinf, const WCHAR *src_file, SP_FILE_COPY_PARA
|
|||
*/
|
||||
static WCHAR *get_destination_dir( HINF hinf, const WCHAR *section )
|
||||
{
|
||||
static const WCHAR Dest[] = {'D','e','s','t','i','n','a','t','i','o','n','D','i','r','s',0};
|
||||
static const WCHAR Def[] = {'D','e','f','a','u','l','t','D','e','s','t','D','i','r',0};
|
||||
INFCONTEXT context;
|
||||
WCHAR systemdir[MAX_PATH], *dir;
|
||||
BOOL ret;
|
||||
|
||||
if (!section || !(ret = SetupFindFirstLineW( hinf, Dest, section, &context )))
|
||||
ret = SetupFindFirstLineW( hinf, Dest, Def, &context );
|
||||
if (!section || !(ret = SetupFindFirstLineW( hinf, L"DestinationDirs", section, &context )))
|
||||
ret = SetupFindFirstLineW( hinf, L"DestinationDirs", L"DefaultDestDir", &context );
|
||||
|
||||
if (ret && (dir = PARSER_get_dest_dir( &context )))
|
||||
return dir;
|
||||
|
@ -411,17 +402,15 @@ static UINT WINAPI extract_cab_cb( void *arg, UINT message, UINT_PTR param1, UIN
|
|||
static BOOL extract_cabinet_file( const WCHAR *cabinet, const WCHAR *root,
|
||||
const WCHAR *src, const WCHAR *dst )
|
||||
{
|
||||
static const WCHAR extW[] = {'.','c','a','b',0};
|
||||
static const WCHAR backslashW[] = {'\\',0};
|
||||
struct extract_cab_ctx ctx = {src, dst};
|
||||
int len = lstrlenW( cabinet );
|
||||
WCHAR path[MAX_PATH];
|
||||
|
||||
/* make sure the cabinet file has a .cab extension */
|
||||
if (len <= 4 || wcsicmp( cabinet + len - 4, extW )) return FALSE;
|
||||
if (len <= 4 || wcsicmp( cabinet + len - 4, L".cab" )) return FALSE;
|
||||
|
||||
lstrcpyW(path, root);
|
||||
lstrcatW(path, backslashW);
|
||||
lstrcatW(path, L"\\" );
|
||||
lstrcatW(path, cabinet);
|
||||
|
||||
return SetupIterateCabinetW( path, 0, extract_cab_cb, &ctx );
|
||||
|
@ -542,7 +531,6 @@ static struct source_media *get_source_media(struct file_queue *queue,
|
|||
*/
|
||||
BOOL WINAPI SetupQueueCopyIndirectW( PSP_FILE_COPY_PARAMS_W params )
|
||||
{
|
||||
static const WCHAR emptyW[] = {0};
|
||||
struct file_queue *queue = params->QueueHandle;
|
||||
struct file_op *op;
|
||||
|
||||
|
@ -558,7 +546,7 @@ BOOL WINAPI SetupQueueCopyIndirectW( PSP_FILE_COPY_PARAMS_W params )
|
|||
if (params->LayoutInf)
|
||||
FIXME("Unhandled LayoutInf %p.\n", params->LayoutInf);
|
||||
|
||||
op->media = get_source_media( queue, params->SourceRootPath ? params->SourceRootPath : emptyW,
|
||||
op->media = get_source_media( queue, params->SourceRootPath ? params->SourceRootPath : L"",
|
||||
params->SourceDescription, params->SourceTagfile );
|
||||
|
||||
TRACE( "root=%s path=%s file=%s -> dir=%s file=%s descr=%s tag=%s\n",
|
||||
|
@ -1058,7 +1046,6 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
|
|||
VS_FIXEDFILEINFO *TargetInfo;
|
||||
VS_FIXEDFILEINFO *SourceInfo;
|
||||
UINT length;
|
||||
static const WCHAR SubBlock[]={'\\',0};
|
||||
DWORD ret;
|
||||
|
||||
VersionSource = HeapAlloc(GetProcessHeap(),0,VersionSizeSource);
|
||||
|
@ -1071,11 +1058,9 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
|
|||
|
||||
if (ret)
|
||||
{
|
||||
ret = VerQueryValueW(VersionSource, SubBlock,
|
||||
(LPVOID*)&SourceInfo, &length);
|
||||
ret = VerQueryValueW(VersionSource, L"\\", (LPVOID*)&SourceInfo, &length);
|
||||
if (ret)
|
||||
ret = VerQueryValueW(VersionTarget, SubBlock,
|
||||
(LPVOID*)&TargetInfo, &length);
|
||||
ret = VerQueryValueW(VersionTarget, L"\\", (LPVOID*)&TargetInfo, &length);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
|
@ -1212,8 +1197,6 @@ BOOL WINAPI SetupInstallFileA( HINF hinf, PINFCONTEXT inf_context, PCSTR source,
|
|||
BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR source, PCWSTR root,
|
||||
PCWSTR dest, DWORD style, PSP_FILE_CALLBACK_W handler, PVOID context, PBOOL in_use )
|
||||
{
|
||||
static const WCHAR CopyFiles[] = {'C','o','p','y','F','i','l','e','s',0};
|
||||
|
||||
BOOL ret, absolute = (root && *root && !(style & SP_COPY_SOURCE_ABSOLUTE));
|
||||
WCHAR *buffer, *p, *inf_source = NULL, dest_path[MAX_PATH];
|
||||
unsigned int len;
|
||||
|
@ -1233,7 +1216,7 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
|
|||
if (!inf_context)
|
||||
{
|
||||
inf_context = &ctx;
|
||||
if (!SetupFindFirstLineW( hinf, CopyFiles, NULL, inf_context )) return FALSE;
|
||||
if (!SetupFindFirstLineW( hinf, L"CopyFiles", NULL, inf_context )) return FALSE;
|
||||
}
|
||||
if (!SetupGetStringFieldW( inf_context, 1, NULL, 0, &len )) return FALSE;
|
||||
if (!(inf_source = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
|
||||
|
@ -1251,7 +1234,7 @@ BOOL WINAPI SetupInstallFileExW( HINF hinf, PINFCONTEXT inf_context, PCWSTR sour
|
|||
if ((dest_dir = get_destination_dir( hinf, NULL )))
|
||||
{
|
||||
lstrcpyW( dest_path, dest_dir );
|
||||
lstrcatW( dest_path, backslashW );
|
||||
lstrcatW( dest_path, L"\\" );
|
||||
heap_free( dest_dir );
|
||||
}
|
||||
}
|
||||
|
@ -1415,7 +1398,7 @@ BOOL WINAPI SetupCommitFileQueueW( HWND owner, HSPFILEQ handle, PSP_FILE_CALLBAC
|
|||
lstrcpyW(src_path, op->src_path);
|
||||
path_len = lstrlenW(src_path);
|
||||
|
||||
lstrcatW(op->media->root, backslashW);
|
||||
lstrcatW(op->media->root, L"\\");
|
||||
lstrcatW(op->media->root, op->src_path);
|
||||
|
||||
heap_free(op->src_path);
|
||||
|
|
Loading…
Reference in New Issue