4 * Copyright 2004 Huw D M Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "wine/unicode.h"
32 #include "wine/debug.h"
34 WINE_DEFAULT_DEBUG_CHANNEL(advpack);
36 typedef HRESULT (WINAPI *DLLREGISTER) (void);
39 /***********************************************************************
42 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
44 TRACE("(%p, %ld, %p)\n",hinstDLL, fdwReason, lpvReserved);
46 if (fdwReason == DLL_PROCESS_ATTACH)
47 DisableThreadLibraryCalls(hinstDLL);
52 /***********************************************************************
53 * LaunchINFSection (ADVPACK.@)
55 void WINAPI LaunchINFSection( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show )
57 FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(cmdline), show );
60 /***********************************************************************
61 * LaunchINFSectionEx (ADVPACK.@)
63 void WINAPI LaunchINFSectionEx( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show )
65 FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(cmdline), show );
68 /* this structure very closely resembles parameters of RunSetupCommand() */
76 } SETUPCOMMAND_PARAMS;
78 /***********************************************************************
79 * DoInfInstall (ADVPACK.@)
81 BOOL WINAPI DoInfInstall(const SETUPCOMMAND_PARAMS *setup)
85 void *callback_context;
87 TRACE("%p %s %s %s %s\n", setup->hwnd, debugstr_a(setup->title),
88 debugstr_a(setup->inf_name), debugstr_a(setup->dir),
89 debugstr_a(setup->section_name));
91 hinf = SetupOpenInfFileA(setup->inf_name, NULL, INF_STYLE_WIN4, NULL);
92 if (hinf == INVALID_HANDLE_VALUE) return FALSE;
94 callback_context = SetupInitDefaultQueueCallback(setup->hwnd);
96 ret = SetupInstallFromInfSectionA(NULL, hinf, setup->section_name, SPINST_ALL,
97 NULL, NULL, 0, SetupDefaultQueueCallbackA,
98 callback_context, NULL, NULL);
99 SetupTermDefaultQueueCallback(callback_context);
100 SetupCloseInfFile(hinf);
105 /***********************************************************************
106 * NeedRebootInit (ADVPACK.@)
108 DWORD WINAPI NeedRebootInit(VOID)
114 /***********************************************************************
115 * NeedReboot (ADVPACK.@)
117 BOOL WINAPI NeedReboot(DWORD dwRebootCheck)
119 FIXME("(0x%08lx) stub!\n", dwRebootCheck);
123 /***********************************************************************
124 * GetVersionFromFile (ADVPACK.@)
126 HRESULT WINAPI GetVersionFromFile( LPSTR Filename, LPDWORD MajorVer,
127 LPDWORD MinorVer, BOOL Version )
129 TRACE("(%s, %p, %p, %d)\n", Filename, MajorVer, MinorVer, Version);
130 return GetVersionFromFileEx(Filename, MajorVer, MinorVer, Version);
133 /***********************************************************************
134 * GetVersionFromFileEx (ADVPACK.@)
136 HRESULT WINAPI GetVersionFromFileEx( LPSTR lpszFilename, LPDWORD pdwMSVer,
137 LPDWORD pdwLSVer, BOOL bVersion )
142 VS_FIXEDFILEINFO *pFixedVersionInfo;
144 TRACE("(%s, %p, %p, %d)\n", lpszFilename, pdwMSVer, pdwLSVer, bVersion);
148 retval = GetFileVersionInfoSizeA(lpszFilename, &hdl);
149 if (retval == 0 || hdl != 0)
152 pVersionInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, retval);
153 if (pVersionInfo == NULL)
155 GetFileVersionInfoA( lpszFilename, 0, retval, pVersionInfo);
157 boolret = VerQueryValueA(pVersionInfo, "\\",
158 (LPVOID) &pFixedVersionInfo, &uiLength);
160 HeapFree(GetProcessHeap(), 0, pVersionInfo);
164 *pdwMSVer = pFixedVersionInfo->dwFileVersionMS;
165 *pdwLSVer = pFixedVersionInfo->dwFileVersionLS;
172 *pdwMSVer = GetUserDefaultUILanguage();
173 *pdwLSVer = GetACP();
179 /***********************************************************************
180 * RegisterOCX (ADVPACK.@)
182 void WINAPI RegisterOCX( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show )
184 WCHAR wszBuff[MAX_PATH];
187 DLLREGISTER pfnRegister;
190 TRACE("(%s)\n", cmdline);
192 MultiByteToWideChar(CP_ACP, 0, cmdline, strlen(cmdline), wszBuff, MAX_PATH);
193 if ((pwcComma = strchrW( wszBuff, ',' ))) *pwcComma = 0;
195 TRACE("Parsed DLL name (%s)\n", debugstr_w(wszBuff));
197 hm = LoadLibraryExW(wszBuff, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
200 ERR("Couldn't load DLL: %s\n", debugstr_w(wszBuff));
204 pfnRegister = (DLLREGISTER)GetProcAddress(hm, "DllRegisterServer");
205 if (pfnRegister == NULL)
207 ERR("DllRegisterServer entry point not found\n");
214 ERR("DllRegisterServer entry point returned %08lx\n", hr);
218 TRACE("Successfully registered OCX\n");
223 /***********************************************************************
224 * DelNodeRunDLL32 (ADVPACK.@)
226 void WINAPI DelNodeRunDLL32( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show )
228 FIXME("(%s) FIXME: stub\n", cmdline);