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/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(advpack
);
36 /***********************************************************************
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
);
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() */
73 } SETUPCOMMAND_PARAMS
;
75 /***********************************************************************
76 * DoInfInstall (ADVPACK.@)
78 BOOL WINAPI
DoInfInstall(const SETUPCOMMAND_PARAMS
*setup
)
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
);
102 /***********************************************************************
103 * NeedRebootInit (ADVPACK.@)
105 DWORD WINAPI
NeedRebootInit(VOID
)
111 /***********************************************************************
112 * NeedReboot (ADVPACK.@)
114 BOOL WINAPI
NeedReboot(DWORD dwRebootCheck
)
116 FIXME("(0x%08lx) stub!\n", dwRebootCheck
);
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
)
139 VS_FIXEDFILEINFO
*pFixedVersionInfo
;
141 TRACE("(%s, %p, %p, %d)\n", lpszFilename
, pdwMSVer
, pdwLSVer
, bVersion
);
145 retval
= GetFileVersionInfoSizeA(lpszFilename
, &hdl
);
146 if (retval
== 0 || hdl
!= 0)
149 pVersionInfo
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, retval
);
150 if (pVersionInfo
== NULL
)
152 GetFileVersionInfoA( lpszFilename
, 0, retval
, pVersionInfo
);
154 boolret
= VerQueryValueA(pVersionInfo
, "\\",
155 (LPVOID
) &pFixedVersionInfo
, &uiLength
);
157 HeapFree(GetProcessHeap(), 0, pVersionInfo
);
161 *pdwMSVer
= pFixedVersionInfo
->dwFileVersionMS
;
162 *pdwLSVer
= pFixedVersionInfo
->dwFileVersionLS
;
169 *pdwMSVer
= GetUserDefaultUILanguage();
170 *pdwLSVer
= GetACP();