Make ShowWindow(...,SW_SHOWNA) also work on already visible windows
[wine/multimedia.git] / dlls / advpack / advpack.c
blobf1f1ce77ba5cdebd3e6cc55d3e1576e83659eede
1 /*
2 * Advpack main
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
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "winreg.h"
27 #include "winver.h"
28 #include "winnls.h"
29 #include "setupapi.h"
30 #include "advpub.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(advpack);
36 /***********************************************************************
37 * DllMain (ADVPACK.@)
39 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
41 TRACE("(%p, %ld, %p)\n",hinstDLL, fdwReason, lpvReserved);
43 if (fdwReason == DLL_PROCESS_ATTACH)
44 DisableThreadLibraryCalls(hinstDLL);
46 return TRUE;
49 /***********************************************************************
50 * LaunchINFSection (ADVPACK.@)
52 void WINAPI LaunchINFSection( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show )
54 FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(cmdline), show );
57 /***********************************************************************
58 * LaunchINFSectionEx (ADVPACK.@)
60 void WINAPI LaunchINFSectionEx( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show )
62 FIXME("%p %p %s %d\n", hWnd, hInst, debugstr_a(cmdline), show );
65 /* this structure very closely resembles parameters of RunSetupCommand() */
66 typedef struct
68 HWND hwnd;
69 LPCSTR title;
70 LPCSTR inf_name;
71 LPCSTR dir;
72 LPCSTR section_name;
73 } SETUPCOMMAND_PARAMS;
75 /***********************************************************************
76 * DoInfInstall (ADVPACK.@)
78 BOOL WINAPI DoInfInstall(const SETUPCOMMAND_PARAMS *setup)
80 BOOL ret;
81 HINF hinf;
82 void *callback_context;
84 TRACE("%p %s %s %s %s\n", setup->hwnd, debugstr_a(setup->title),
85 debugstr_a(setup->inf_name), debugstr_a(setup->dir),
86 debugstr_a(setup->section_name));
88 hinf = SetupOpenInfFileA(setup->inf_name, NULL, INF_STYLE_WIN4, NULL);
89 if (hinf == INVALID_HANDLE_VALUE) return FALSE;
91 callback_context = SetupInitDefaultQueueCallback(setup->hwnd);
93 ret = SetupInstallFromInfSectionA(NULL, hinf, setup->section_name, SPINST_ALL,
94 NULL, NULL, 0, SetupDefaultQueueCallbackA,
95 callback_context, NULL, NULL);
96 SetupTermDefaultQueueCallback(callback_context);
97 SetupCloseInfFile(hinf);
99 return ret;
102 /***********************************************************************
103 * NeedRebootInit (ADVPACK.@)
105 DWORD WINAPI NeedRebootInit(VOID)
107 FIXME("() stub!\n");
108 return 0;
111 /***********************************************************************
112 * NeedReboot (ADVPACK.@)
114 BOOL WINAPI NeedReboot(DWORD dwRebootCheck)
116 FIXME("(0x%08lx) stub!\n", dwRebootCheck);
117 return FALSE;
120 /***********************************************************************
121 * GetVersionFromFile (ADVPACK.@)
123 HRESULT WINAPI GetVersionFromFile( LPSTR Filename, LPDWORD MajorVer,
124 LPDWORD MinorVer, BOOL Version )
126 TRACE("(%s, %p, %p, %d)\n", Filename, MajorVer, MinorVer, Version);
127 return GetVersionFromFileEx(Filename, MajorVer, MinorVer, Version);
130 /***********************************************************************
131 * GetVersionFromFileEx (ADVPACK.@)
133 HRESULT WINAPI GetVersionFromFileEx( LPSTR lpszFilename, LPDWORD pdwMSVer,
134 LPDWORD pdwLSVer, BOOL bVersion )
136 DWORD hdl, retval;
137 LPVOID pVersionInfo;
138 BOOL boolret;
139 VS_FIXEDFILEINFO *pFixedVersionInfo;
140 UINT uiLength;
141 TRACE("(%s, %p, %p, %d)\n", lpszFilename, pdwMSVer, pdwLSVer, bVersion);
143 if (bVersion)
145 retval = GetFileVersionInfoSizeA(lpszFilename, &hdl);
146 if (retval == 0 || hdl != 0)
147 return E_FAIL;
149 pVersionInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, retval);
150 if (pVersionInfo == NULL)
151 return E_FAIL;
152 GetFileVersionInfoA( lpszFilename, 0, retval, pVersionInfo);
154 boolret = VerQueryValueA(pVersionInfo, "\\",
155 (LPVOID) &pFixedVersionInfo, &uiLength);
157 HeapFree(GetProcessHeap(), 0, pVersionInfo);
159 if (boolret)
161 *pdwMSVer = pFixedVersionInfo->dwFileVersionMS;
162 *pdwLSVer = pFixedVersionInfo->dwFileVersionLS;
164 else
165 return E_FAIL;
167 else
169 *pdwMSVer = GetUserDefaultUILanguage();
170 *pdwLSVer = GetACP();
173 return S_OK;