mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-01 19:28:29 +00:00
appwiz.cpl: Build with msvcrt.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
72d6759f3a
commit
ed43537189
|
@ -2,6 +2,8 @@ MODULE = appwiz.cpl
|
|||
IMPORTS = uuid urlmon advpack comctl32 advapi32 shell32 ole32 user32 comdlg32 bcrypt
|
||||
DELAYIMPORTS = msi
|
||||
|
||||
EXTRADLLFLAGS = -mno-cygwin
|
||||
|
||||
C_SRCS = \
|
||||
addons.c \
|
||||
appwiz.c
|
||||
|
|
|
@ -16,16 +16,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>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define COBJMACROS
|
||||
#define NONAMELESSUNION
|
||||
|
@ -48,7 +42,6 @@
|
|||
#include "res.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/library.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(appwizcpl);
|
||||
|
||||
|
@ -111,6 +104,12 @@ static LPWSTR url = NULL;
|
|||
static IBinding *dwl_binding;
|
||||
static WCHAR *msi_file;
|
||||
|
||||
static const WCHAR winehomedirW[] = {'W','I','N','E','H','O','M','E','D','I','R',0};
|
||||
static const WCHAR winedatadirW[] = {'W','I','N','E','D','A','T','A','D','I','R',0};
|
||||
static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0};
|
||||
|
||||
extern const char * CDECL wine_get_version(void);
|
||||
|
||||
static WCHAR * (CDECL *p_wine_get_dos_file_name)(const char*);
|
||||
static const WCHAR kernel32_dllW[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
|
||||
|
||||
|
@ -199,57 +198,52 @@ static enum install_res install_file(const WCHAR *file_name)
|
|||
return INSTALL_OK;
|
||||
}
|
||||
|
||||
static enum install_res install_from_unix_file(const char *dir, const char *subdir, const char *file_name)
|
||||
static enum install_res install_from_dos_file(const WCHAR *dir, const char *subdir, const char *file_name)
|
||||
{
|
||||
LPWSTR dos_file_name;
|
||||
char *file_path;
|
||||
int fd, len;
|
||||
static const WCHAR ntprefixW[] = {'\\','?','?','\\',0};
|
||||
WCHAR *path;
|
||||
enum install_res ret;
|
||||
int len = lstrlenW( dir );
|
||||
int size = len + 1;
|
||||
|
||||
len = strlen(dir);
|
||||
file_path = heap_alloc(len+strlen(subdir)+strlen(file_name)+3);
|
||||
if(!file_path)
|
||||
return INSTALL_FAILED;
|
||||
size += MultiByteToWideChar( CP_UNIXCP, 0, subdir, -1, NULL, 0 );
|
||||
size += MultiByteToWideChar( CP_UNIXCP, 0, file_name, -1, NULL, 0 );
|
||||
if (!(path = heap_alloc( size * sizeof(WCHAR) ))) return INSTALL_FAILED;
|
||||
|
||||
memcpy(file_path, dir, len);
|
||||
if(len && file_path[len-1] != '/' && file_path[len-1] != '\\')
|
||||
file_path[len++] = '/';
|
||||
if(*subdir) {
|
||||
strcpy(file_path+len, subdir);
|
||||
len += strlen(subdir);
|
||||
file_path[len++] = '/';
|
||||
lstrcpyW( path, dir );
|
||||
if (!wcsncmp( path, ntprefixW, wcslen(ntprefixW) )) path[1] = '\\'; /* change \??\ into \\?\ */
|
||||
if (len && path[len-1] != '/' && path[len-1] != '\\') path[len++] = '\\';
|
||||
|
||||
if (*subdir)
|
||||
{
|
||||
len += MultiByteToWideChar( CP_UNIXCP, 0, subdir, -1, path + len, size - len );
|
||||
path[len - 1] = '\\';
|
||||
}
|
||||
strcpy(file_path+len, file_name);
|
||||
MultiByteToWideChar( CP_UNIXCP, 0, file_name, -1, path + len, size - len );
|
||||
|
||||
fd = open(file_path, O_RDONLY);
|
||||
if(fd == -1) {
|
||||
TRACE("%s not found\n", debugstr_a(file_path));
|
||||
heap_free(file_path);
|
||||
if (GetFileAttributesW( path ) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
TRACE( "%s not found\n", debugstr_w(path) );
|
||||
heap_free( path );
|
||||
return INSTALL_NEXT;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
ret = install_file( path );
|
||||
|
||||
if(p_wine_get_dos_file_name) { /* Wine UNIX mode */
|
||||
dos_file_name = p_wine_get_dos_file_name(file_path);
|
||||
if(!dos_file_name) {
|
||||
ERR("Could not get dos file name of %s\n", debugstr_a(file_path));
|
||||
heap_free(file_path);
|
||||
return INSTALL_FAILED;
|
||||
}
|
||||
} else { /* Windows mode */
|
||||
UINT res;
|
||||
WARN("Could not get wine_get_dos_file_name function, calling install_cab directly.\n");
|
||||
res = MultiByteToWideChar( CP_ACP, 0, file_path, -1, 0, 0);
|
||||
dos_file_name = heap_alloc (res*sizeof(WCHAR));
|
||||
MultiByteToWideChar( CP_ACP, 0, file_path, -1, dos_file_name, res);
|
||||
heap_free( path );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static enum install_res install_from_unix_file(const char *dir, const char *subdir, const char *file_name)
|
||||
{
|
||||
WCHAR *dos_dir;
|
||||
enum install_res ret = INSTALL_NEXT;
|
||||
|
||||
if (p_wine_get_dos_file_name && (dos_dir = p_wine_get_dos_file_name( dir )))
|
||||
{
|
||||
ret = install_from_dos_file( dos_dir, subdir, file_name );
|
||||
heap_free( dos_dir );
|
||||
}
|
||||
|
||||
heap_free(file_path);
|
||||
|
||||
ret = install_file(dos_file_name);
|
||||
|
||||
heap_free(dos_file_name);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -296,8 +290,6 @@ static enum install_res install_from_registered_dir(void)
|
|||
return INSTALL_FAILED;
|
||||
}
|
||||
|
||||
TRACE("Trying %s/%s\n", debugstr_a(package_dir), debugstr_a(addon->file_name));
|
||||
|
||||
ret = install_from_unix_file(package_dir, "", addon->file_name);
|
||||
|
||||
heap_free(package_dir);
|
||||
|
@ -306,25 +298,25 @@ static enum install_res install_from_registered_dir(void)
|
|||
|
||||
static enum install_res install_from_default_dir(void)
|
||||
{
|
||||
const char *data_dir, *package_dir;
|
||||
char *dir_buf = NULL;
|
||||
int len;
|
||||
enum install_res ret;
|
||||
static const WCHAR dotdotW[] = {'\\','.','.','\\',0};
|
||||
const WCHAR *package_dir;
|
||||
WCHAR *dir_buf = NULL;
|
||||
enum install_res ret = INSTALL_NEXT;
|
||||
|
||||
if((data_dir = wine_get_data_dir())) {
|
||||
package_dir = data_dir;
|
||||
}else if((data_dir = wine_get_build_dir())) {
|
||||
len = strlen(data_dir);
|
||||
dir_buf = heap_alloc(len + sizeof("/../"));
|
||||
memcpy(dir_buf, data_dir, len);
|
||||
strcpy(dir_buf+len, "/../");
|
||||
if ((package_dir = _wgetenv( winebuilddirW )))
|
||||
{
|
||||
dir_buf = heap_alloc( lstrlenW(package_dir) * sizeof(WCHAR) + sizeof(dotdotW));
|
||||
lstrcpyW( dir_buf, package_dir );
|
||||
lstrcatW( dir_buf, dotdotW );
|
||||
package_dir = dir_buf;
|
||||
}else {
|
||||
return INSTALL_NEXT;
|
||||
}
|
||||
else package_dir = _wgetenv( winedatadirW );
|
||||
|
||||
ret = install_from_unix_file(package_dir, addon->subdir_name, addon->file_name);
|
||||
heap_free(dir_buf);
|
||||
if (package_dir)
|
||||
{
|
||||
ret = install_from_dos_file(package_dir, addon->subdir_name, addon->file_name);
|
||||
heap_free(dir_buf);
|
||||
}
|
||||
|
||||
if (ret == INSTALL_NEXT)
|
||||
ret = install_from_unix_file(INSTALL_DATADIR "/wine/", addon->subdir_name, addon->file_name);
|
||||
|
@ -337,64 +329,56 @@ static enum install_res install_from_default_dir(void)
|
|||
|
||||
static WCHAR *get_cache_file_name(BOOL ensure_exists)
|
||||
{
|
||||
const char *home_dir = NULL, *xdg_cache_dir;
|
||||
size_t len, size = strlen(addon->file_name) + 7; /* strlen("/wine/"), '\0' */
|
||||
char *cache_file_name;
|
||||
WCHAR *ret;
|
||||
static const WCHAR cacheW[] = {'\\','.','c','a','c','h','e',0};
|
||||
static const WCHAR wineW[] = {'\\','w','i','n','e',0};
|
||||
const char *xdg_dir;
|
||||
const WCHAR *home_dir;
|
||||
WCHAR *cache_dir, *ret;
|
||||
size_t len, size;
|
||||
|
||||
/* non-Wine (eg. Windows) cache is currently not supported */
|
||||
if(!p_wine_get_dos_file_name)
|
||||
return NULL;
|
||||
|
||||
xdg_cache_dir = getenv("XDG_CACHE_HOME");
|
||||
if(xdg_cache_dir && *xdg_cache_dir) {
|
||||
size += strlen(xdg_cache_dir);
|
||||
}else {
|
||||
home_dir = getenv("HOME");
|
||||
if(!home_dir)
|
||||
return NULL;
|
||||
|
||||
size += strlen(home_dir) + 8; /* strlen("/.cache/") */
|
||||
xdg_dir = getenv( "XDG_CACHE_HOME" );
|
||||
if (xdg_dir && *xdg_dir && p_wine_get_dos_file_name)
|
||||
{
|
||||
if (!(cache_dir = p_wine_get_dos_file_name( xdg_dir ))) return NULL;
|
||||
}
|
||||
|
||||
cache_file_name = heap_alloc(size);
|
||||
if(!cache_file_name)
|
||||
return NULL;
|
||||
|
||||
if(xdg_cache_dir && *xdg_cache_dir) {
|
||||
len = strlen(xdg_cache_dir);
|
||||
if(len > 1 && xdg_cache_dir[len-1] == '/')
|
||||
len--;
|
||||
memcpy(cache_file_name, xdg_cache_dir, len);
|
||||
cache_file_name[len] = 0;
|
||||
}else {
|
||||
len = strlen(home_dir);
|
||||
memcpy(cache_file_name, home_dir, len);
|
||||
strcpy(cache_file_name+len, "/.cache");
|
||||
len += 7;
|
||||
else if ((home_dir = _wgetenv( winehomedirW )))
|
||||
{
|
||||
if (!(cache_dir = heap_alloc( lstrlenW(home_dir) * sizeof(WCHAR) + sizeof(cacheW) ))) return NULL;
|
||||
lstrcpyW( cache_dir, home_dir );
|
||||
lstrcatW( cache_dir, cacheW );
|
||||
cache_dir[1] = '\\'; /* change \??\ into \\?\ */
|
||||
}
|
||||
else return NULL;
|
||||
|
||||
if(ensure_exists && mkdir(cache_file_name, 0777) && errno != EEXIST) {
|
||||
WARN("%s does not exist and could not be created: %s\n", cache_file_name, strerror(errno));
|
||||
heap_free(cache_file_name);
|
||||
if (ensure_exists && !CreateDirectoryW( cache_dir, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
WARN( "%s does not exist and could not be created (%u)\n", debugstr_w(cache_dir), GetLastError() );
|
||||
heap_free( cache_dir );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
strcpy(cache_file_name+len, "/wine");
|
||||
len += 5;
|
||||
|
||||
if(ensure_exists && mkdir(cache_file_name, 0777) && errno != EEXIST) {
|
||||
WARN("%s does not exist and could not be created: %s\n", cache_file_name, strerror(errno));
|
||||
size = lstrlenW( cache_dir ) + ARRAY_SIZE(wineW);
|
||||
size += MultiByteToWideChar( CP_UNIXCP, 0, addon->file_name, -1, NULL, 0 );
|
||||
if (!(ret = heap_alloc( size * sizeof(WCHAR) )))
|
||||
{
|
||||
heap_free( cache_dir );
|
||||
return NULL;
|
||||
}
|
||||
lstrcpyW( ret, cache_dir );
|
||||
lstrcatW( ret, wineW );
|
||||
heap_free( cache_dir );
|
||||
|
||||
cache_file_name[len++] = '/';
|
||||
strcpy(cache_file_name+len, addon->file_name);
|
||||
ret = p_wine_get_dos_file_name(cache_file_name);
|
||||
if (ensure_exists && !CreateDirectoryW( ret, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
WARN( "%s does not exist and could not be created (%u)\n", debugstr_w(ret), GetLastError() );
|
||||
heap_free( ret );
|
||||
return NULL;
|
||||
}
|
||||
len = lstrlenW( ret );
|
||||
ret[len++] = '\\';
|
||||
MultiByteToWideChar( CP_UNIXCP, 0, addon->file_name, -1, ret + len, size - len );
|
||||
|
||||
TRACE("%s -> %s\n", cache_file_name, debugstr_w(ret));
|
||||
|
||||
heap_free(cache_file_name);
|
||||
TRACE( "got %s\n", debugstr_w(ret) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -635,7 +619,7 @@ static void append_url_params( WCHAR *url )
|
|||
static const WCHAR v_formatW[] = {'&','v','='};
|
||||
static const WCHAR winevW[] = {'&','w','i','n','e','v','='};
|
||||
DWORD size = INTERNET_MAX_URL_LENGTH * sizeof(WCHAR);
|
||||
DWORD len = strlenW(url);
|
||||
DWORD len = lstrlenW(url);
|
||||
|
||||
memcpy(url+len, arch_formatW, sizeof(arch_formatW));
|
||||
len += ARRAY_SIZE(arch_formatW);
|
||||
|
@ -646,7 +630,7 @@ static void append_url_params( WCHAR *url )
|
|||
len += MultiByteToWideChar(CP_ACP, 0, addon->version, -1, url+len, size/sizeof(WCHAR)-len)-1;
|
||||
memcpy(url+len, winevW, sizeof(winevW));
|
||||
len += ARRAY_SIZE(winevW);
|
||||
MultiByteToWideChar(CP_ACP, 0, PACKAGE_VERSION, -1, url+len, size/sizeof(WCHAR)-len);
|
||||
MultiByteToWideChar(CP_ACP, 0, wine_get_version(), -1, url+len, size/sizeof(WCHAR)-len);
|
||||
}
|
||||
|
||||
static LPWSTR get_url(void)
|
||||
|
@ -717,7 +701,7 @@ static void run_winebrowser(const WCHAR *url)
|
|||
|
||||
static const WCHAR winebrowserW[] = {'\\','w','i','n','e','b','r','o','w','s','e','r','.','e','x','e',0};
|
||||
|
||||
url_len = strlenW(url);
|
||||
url_len = lstrlenW(url);
|
||||
|
||||
len = GetSystemDirectoryW(app, MAX_PATH - ARRAY_SIZE(winebrowserW));
|
||||
memcpy(app+len, winebrowserW, sizeof(winebrowserW));
|
||||
|
|
|
@ -25,9 +25,6 @@
|
|||
|
||||
#define NONAMELESSUNION
|
||||
|
||||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -42,7 +39,6 @@
|
|||
#include <commdlg.h>
|
||||
#include <cpl.h>
|
||||
|
||||
#include "wine/unicode.h"
|
||||
#include "wine/list.h"
|
||||
#include "wine/debug.h"
|
||||
#include "appwiz.h"
|
||||
|
@ -249,12 +245,12 @@ static BOOL ReadApplicationsFromRegistry(HKEY root)
|
|||
&displen);
|
||||
|
||||
/* separate the index from the icon name, if supplied */
|
||||
iconPtr = strchrW(info->icon, ',');
|
||||
iconPtr = wcschr(info->icon, ',');
|
||||
|
||||
if (iconPtr)
|
||||
{
|
||||
*iconPtr++ = 0;
|
||||
info->iconIdx = atoiW(iconPtr);
|
||||
info->iconIdx = wcstol(iconPtr, NULL, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,7 +455,7 @@ static void InstallProgram(HWND hWnd)
|
|||
LoadStringW(hInst, IDS_FILTER_PROGRAMS, filter_programs, ARRAY_SIZE(filter_programs));
|
||||
LoadStringW(hInst, IDS_FILTER_ALL, filter_all, ARRAY_SIZE(filter_all));
|
||||
|
||||
snprintfW( FilterBufferW, MAX_PATH, filters, filter_installs, 0, 0,
|
||||
swprintf( FilterBufferW, MAX_PATH, filters, filter_installs, 0, 0,
|
||||
filter_programs, 0, 0, filter_all, 0, 0 );
|
||||
memset(&ofn, 0, sizeof(OPENFILENAMEW));
|
||||
ofn.lStructSize = sizeof(OPENFILENAMEW);
|
||||
|
@ -969,12 +965,12 @@ static LONG start_params(const WCHAR *params)
|
|||
if(!params)
|
||||
return FALSE;
|
||||
|
||||
if(!strcmpW(params, install_geckoW)) {
|
||||
if(!wcscmp(params, install_geckoW)) {
|
||||
install_addon(ADDON_GECKO);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if(!strcmpW(params, install_monoW)) {
|
||||
if(!wcscmp(params, install_monoW)) {
|
||||
install_addon(ADDON_MONO);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
*/
|
||||
|
||||
#include "wine/heap.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "winnls.h"
|
||||
|
||||
typedef enum {
|
||||
ADDON_GECKO,
|
||||
|
@ -33,7 +33,7 @@ static inline WCHAR *heap_strdupW(const WCHAR *str)
|
|||
WCHAR *ret;
|
||||
|
||||
if(str) {
|
||||
size_t size = strlenW(str)+1;
|
||||
size_t size = lstrlenW(str)+1;
|
||||
ret = heap_alloc(size*sizeof(WCHAR));
|
||||
if(ret)
|
||||
memcpy(ret, str, size*sizeof(WCHAR));
|
||||
|
|
Loading…
Reference in a new issue