comctl32: Create a manifest file at dll registration time.

This commit is contained in:
Alexandre Julliard 2007-08-14 12:31:27 +02:00
parent f42b1e9b9c
commit 6790cdb8f5
2 changed files with 92 additions and 4 deletions

View File

@ -71,6 +71,58 @@
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
#define NAME "microsoft.windows.common-controls"
#define FILE "comctl32.dll"
#define VERSION "6.0.0.0"
#define PUBLIC_KEY "6595b64144ccf1df"
#ifdef __i386__
#define ARCH "x86"
#elif defined __x86_64__
#define ARCH "amd64"
#else
#define ARCH "none"
#endif
static const char manifest[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">\n"
" <assemblyIdentity type=\"win32\" name=\"" NAME "\" version=\"" VERSION "\" processorArchitecture=\"" ARCH "\" publicKeyToken=\"" PUBLIC_KEY "\"/>\n"
" <file name=\"" FILE "\">\n"
" <windowClass>Button</windowClass>\n"
" <windowClass>ButtonListBox</windowClass>\n"
" <windowClass>ComboBoxEx32</windowClass>\n"
" <windowClass>ComboLBox</windowClass>\n"
" <windowClass>Combobox</windowClass>\n"
" <windowClass>Edit</windowClass>\n"
" <windowClass>Listbox</windowClass>\n"
" <windowClass>NativeFontCtl</windowClass>\n"
" <windowClass>ReBarWindow32</windowClass>\n"
" <windowClass>ScrollBar</windowClass>\n"
" <windowClass>Static</windowClass>\n"
" <windowClass>SysAnimate32</windowClass>\n"
" <windowClass>SysDateTimePick32</windowClass>\n"
" <windowClass>SysHeader32</windowClass>\n"
" <windowClass>SysIPAddress32</windowClass>\n"
" <windowClass>SysLink</windowClass>\n"
" <windowClass>SysListView32</windowClass>\n"
" <windowClass>SysMonthCal32</windowClass>\n"
" <windowClass>SysPager</windowClass>\n"
" <windowClass>SysTabControl32</windowClass>\n"
" <windowClass>SysTreeView32</windowClass>\n"
" <windowClass>ToolbarWindow32</windowClass>\n"
" <windowClass>msctls_hotkey32</windowClass>\n"
" <windowClass>msctls_progress32</windowClass>\n"
" <windowClass>msctls_statusbar32</windowClass>\n"
" <windowClass>msctls_trackbar32</windowClass>\n"
" <windowClass>msctls_updown32</windowClass>\n"
" <windowClass>tooltips_class32</windowClass>\n"
" </file>\n"
"</assembly>\n";
static const char manifest_filename[] = ARCH "_" NAME "_" PUBLIC_KEY "_" VERSION "_none_deadbeef.manifest";
LRESULT WINAPI COMCTL32_SubclassProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
LPWSTR COMCTL32_wSubclass = NULL;
@ -91,6 +143,42 @@ static const WCHAR strCC32SubclassInfo[] = {
'C','C','3','2','S','u','b','c','l','a','s','s','I','n','f','o',0
};
static BOOL create_manifest( BOOL install )
{
static const WCHAR dirW[] = {'\\','w','i','n','s','x','s','\\','m','a','n','i','f','e','s','t','s','\\',0};
DWORD len, written;
WCHAR *buffer;
HANDLE file;
BOOL ret = FALSE;
len = MultiByteToWideChar( CP_UTF8, 0, manifest_filename, sizeof(manifest_filename), NULL, 0 );
len += GetWindowsDirectoryW( NULL, 0 );
len = len * sizeof(WCHAR) + sizeof(dirW);
if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE;
GetWindowsDirectoryW( buffer, len );
lstrcatW( buffer, dirW );
MultiByteToWideChar( CP_UTF8, 0, manifest_filename, sizeof(manifest_filename),
buffer + lstrlenW(buffer), len );
if (install)
{
file = CreateFileW( buffer, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL );
if (file != INVALID_HANDLE_VALUE)
{
ret = (WriteFile( file, manifest, sizeof(manifest)-1, &written, NULL ) &&
written == sizeof(manifest)-1);
CloseHandle( file );
if (!ret) DeleteFileW( buffer );
else TRACE("created %s\n", debugstr_w(buffer));
}
}
else ret = DeleteFileW( buffer );
HeapFree( GetProcessHeap(), 0, buffer );
return ret;
}
/***********************************************************************
* DllMain [Internal]
*
@ -917,10 +1005,9 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO *pdvi)
*/
HRESULT WINAPI DllInstall(BOOL bInstall, LPCWSTR cmdline)
{
FIXME("(%s, %s): stub\n", bInstall?"TRUE":"FALSE",
debugstr_w(cmdline));
return S_OK;
TRACE("(%u, %s): stub\n", bInstall, debugstr_w(cmdline));
if (!create_manifest( bInstall )) return HRESULT_FROM_WIN32(GetLastError());
return S_OK;
}
/***********************************************************************

View File

@ -2126,6 +2126,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G"
11,,avifil32.dll,1
11,,browseui.dll,1
11,,comcat.dll,1
11,,comctl32.dll,2
11,,d3dxof.dll,1
11,,ddraw.dll,1
11,,ddrawex.dll,1