This MR stems out from testing if an app may be detecting Wine presence by checking wine_get_version() entry point presence in ntdll.
I had wished that simply commenting out the entry point in ntdll.spec would be sufficient.
It isn't as 2 buitin DLLs directly link to wine_get_version(). This MR let them dynamically load the entry point's address.
For the record, there are three other DLLs/programs which make use of wine_get_version(), but using dynamic loading.
I can live without this MR being merged upstream, but looked a good idea: - to be consistent throughout the code - allow the simple comment in ntdll.spec to be possible.
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/appwiz.cpl/addons.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/appwiz.cpl/addons.c b/dlls/appwiz.cpl/addons.c index a2957c3040a..88f871be53b 100644 --- a/dlls/appwiz.cpl/addons.c +++ b/dlls/appwiz.cpl/addons.c @@ -108,8 +108,7 @@ static LPWSTR url = NULL; static IBinding *dwl_binding; static WCHAR *msi_file;
-extern const char * CDECL wine_get_version(void); - +static const char * (CDECL *p_wine_get_version)(void); static WCHAR * (CDECL *p_wine_get_dos_file_name)(const char*);
static BOOL sha_check(const WCHAR *file_name) @@ -610,7 +609,7 @@ static void append_url_params( WCHAR *url ) len += MultiByteToWideChar(CP_ACP, 0, addon->version, -1, url+len, size/sizeof(WCHAR)-len)-1; lstrcpyW(url+len, L"&winev="); len += lstrlenW(L"&winev="); - MultiByteToWideChar(CP_ACP, 0, wine_get_version(), -1, url+len, size/sizeof(WCHAR)-len); + MultiByteToWideChar(CP_ACP, 0, p_wine_get_version() ? p_wine_get_version() : 0, -1, url+len, size/sizeof(WCHAR)-len); }
static LPWSTR get_url(void) @@ -751,6 +750,7 @@ BOOL install_addon(addon_t addon_type) addon = addons_info+addon_type;
p_wine_get_dos_file_name = (void *)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "wine_get_dos_file_name"); + p_wine_get_version = (void *)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "wine_get_version");
/* * Try to find addon .msi file in following order:
From: Eric Pouech epouech@codeweavers.com
Signed-off-by: Eric Pouech epouech@codeweavers.com --- dlls/user32/nonclient.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 00c7368c516..b28e9e258da 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -159,12 +159,16 @@ LRESULT NC_HandleSysCommand( HWND hwnd, WPARAM wParam, LPARAM lParam ) if (hmodule) { BOOL (WINAPI *aboutproc)(HWND, LPCSTR, LPCSTR, HICON); - extern const char * CDECL wine_get_version(void); + const char * (CDECL *p_wine_get_version)(void); char app[256];
- sprintf( app, "Wine %s", wine_get_version() ); + p_wine_get_version = (void *)GetProcAddress( GetModuleHandleW(L"ntdll.dll"), "wine_get_version" ); aboutproc = (void *)GetProcAddress( hmodule, "ShellAboutA" ); - if (aboutproc) aboutproc( hwnd, app, NULL, 0 ); + if (p_wine_get_version && aboutproc) + { + snprintf( app, ARRAY_SIZE(app), "Wine %s", p_wine_get_version() ); + aboutproc( hwnd, app, NULL, 0 ); + } FreeLibrary( hmodule ); } }