4 * Copyright 1998,2000 Andreas Mohr
6 * FIXME: Rather non-functional functions for now.
9 * http://www.geocities.com/SiliconValley/Network/5317/drivers.html
10 * http://willemer.de/informatik/windows/inf_info.htm (German)
11 * http://www.microsoft.com/ddk/ddkdocs/win98ddk/devinst_12uw.htm
13 * http://mmatrix.tripod.com/customsystemfolder/infsysntaxfull.html
14 * http://www.rdrop.com/~cary/html/inf_faq.html
16 * Stuff tested with rs405deu.exe (German Acroread 4.05 setup)
21 #include "wine/winuser16.h"
24 #include "debugtools.h"
26 DEFAULT_DEBUG_CHANNEL(setupx);
28 /***********************************************************************
31 DWORD WINAPI SURegOpenKey( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey )
33 FIXME("(%x,%s,%p), semi-stub.\n",hkey,debugstr_a(lpszSubKey),retkey);
34 return RegOpenKeyA( hkey, lpszSubKey, retkey );
37 /***********************************************************************
40 DWORD WINAPI SURegQueryValueEx( HKEY hkey, LPSTR lpszValueName,
41 LPDWORD lpdwReserved, LPDWORD lpdwType,
42 LPBYTE lpbData, LPDWORD lpcbData )
44 FIXME("(%x,%s,%p,%p,%p,%ld), semi-stub.\n",hkey,debugstr_a(lpszValueName),
45 lpdwReserved,lpdwType,lpbData,lpcbData?*lpcbData:0);
46 return RegQueryValueExA( hkey, lpszValueName, lpdwReserved, lpdwType,
51 * hwnd = parent window
52 * hinst = instance of SETUPX.DLL
53 * lpszCmdLine = e.g. "DefaultInstall 132 C:\MYINSTALL\MYDEV.INF"
54 * Here "DefaultInstall" is the .inf file section to be installed (optional).
55 * 132 is the standard parameter, it seems.
56 * 133 means don't prompt user for reboot.
58 * nCmdShow = nCmdShow of CreateProcess
59 * FIXME: is the return type correct ?
61 DWORD WINAPI InstallHinfSection16( HWND16 hwnd, HINSTANCE16 hinst, LPCSTR lpszCmdLine, INT16 nCmdShow)
63 FIXME("(%04x, %04x, %s, %d), stub.\n", hwnd, hinst, lpszCmdLine, nCmdShow);
70 LPCSTR StdString; /* fallback string; sub dir of windows directory */
73 static LDID_DATA LDID_Data[34] =
75 { /* 0 (LDID_NULL) -- not defined */
79 { /* 1 (LDID_SRCPATH) = source of installation. hmm, what to do here ? */
80 "SourcePath", /* hmm, does SETUPX have to care about updating it ?? */
83 { /* 2 (LDID_SETUPTEMP) = setup temp dir */
87 { /* 3 (LDID_UNINSTALL) = uninstall backup dir */
91 { /* 4 (LDID_BACKUP) = backup dir */
95 { /* 5 (LDID_SETUPSCRATCH) = setup scratch dir */
99 { /* 6 -- not defined */
103 { /* 7 -- not defined */
107 { /* 8 -- not defined */
111 { /* 9 -- not defined */
115 { /* 10 (LDID_WIN) = windows dir */
119 { /* 11 (LDID_SYS) = system dir */
121 NULL /* call GetSystemDirectory() instead */
123 { /* 12 (LDID_IOS) = IOSubSys dir */
124 NULL, /* FIXME: registry string ? */
127 { /* 13 (LDID_CMD) = COMMAND dir */
128 NULL, /* FIXME: registry string ? */
131 { /* 14 (LDID_CPL) = control panel dir */
135 { /* 15 (LDID_PRINT) = windows printer dir */
137 "SYSTEM" /* correct ?? */
139 { /* 16 (LDID_MAIL) = destination mail dir */
143 { /* 17 (LDID_INF) = INF dir */
144 "SetupScratchDir", /* correct ? */
147 { /* 18 (LDID_HELP) = HELP dir */
151 { /* 19 (LDID_WINADMIN) = Admin dir */
155 { /* 20 (LDID_FONTS) = Fonts dir */
159 { /* 21 (LDID_VIEWERS) = Viewers */
163 { /* 22 (LDID_VMM32) = VMM32 dir */
167 { /* 23 (LDID_COLOR) = ICM dir */
171 { /* 24 (LDID_APPS) = root of boot drive ? */
175 { /* 25 (LDID_SHARED) = shared dir */
179 { /* 26 (LDID_WINBOOT) = Windows boot dir */
183 { /* 27 (LDID_MACHINE) = machine specific files */
187 { /* 28 (LDID_HOST_WINBOOT) = Host Windows boot dir */
191 { /* 29 -- not defined */
195 { /* 30 (LDID_BOOT) = Root of boot drive */
199 { /* 31 (LDID_BOOT_HOST) = Root of boot drive host */
203 { /* 32 (LDID_OLD_WINBOOT) = subdir of root */
207 { /* 33 (LDID_OLD_WIN) = old win dir */
211 /* the rest (34-38) isn't too interesting, so I'll forget about it */
215 * Translate a logical disk identifier (LDID) into its string representation
217 BOOL SETUPX_TranslateLDID(int ldid, LPSTR buffer, WORD buflen)
219 BOOL handled = FALSE;
221 if ((ldid >= LDID_SRCPATH) && (ldid <= LDID_OLD_WIN))
223 if (LDID_Data[ldid].RegValName)
227 if (RegOpenKeyA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup", &hKey) == ERROR_SUCCESS)
229 DWORD type, len = buflen;
231 if ( (RegQueryValueExA(hKey, LDID_Data[ldid].RegValName,
232 NULL, &type, buffer, &len) == ERROR_SUCCESS)
233 && (type == REG_SZ) )
235 TRACE("found value '%s' for LDID %d\n", buffer, ldid);
248 FIXME("LDID_SRCPATH: what exactly do we have to do here ?\n");
251 GetSystemDirectoryA(buffer, buflen);
256 case LDID_HOST_WINBOOT:
259 strncpy(buffer, "C:\\", buflen);
260 buffer[buflen-1] = '\0';
263 case 49001: /* what's this ???
264 does this have to pop up a dialog or what ? */
265 strncpy(buffer, "C:\\Program Files", buflen);
266 buffer[buflen-1] = '\0';
267 FIXME("what is LDID 49001 ?? returning %s for now.\n", buffer);
271 if (LDID_Data[ldid].StdString)
273 UINT len = GetWindowsDirectoryA(buffer, buflen);
280 strncpy(buffer, LDID_Data[ldid].StdString, buflen);
281 buffer[buflen-1] = '\0';
290 FIXME("unimplemented LDID %d\n", ldid);
296 * GenFormStrWithoutPlaceHolders
298 void WINAPI GenFormStrWithoutPlaceHolders16( LPSTR szDst, LPCSTR szSrc, HINF16 hInf)
300 LPCSTR pSrc = szSrc, pSrcEnd = szSrc + strlen(szSrc);
301 LPSTR pDst = szDst, p, pPHBegin;
304 FIXME("(%p, '%s', %04x), semi stub.\n", szDst, szSrc, hInf);
305 while (pSrc < pSrcEnd)
307 p = strchr(pSrc, '%');
310 count = (int)p - (int)pSrc;
311 strncpy(pDst, pSrc, count);
315 p = strchr(pPHBegin, '%');
318 char placeholder[80]; /* that really ought to be enough ;) */
321 count = (int)p - (int)pPHBegin;
322 strncpy(placeholder, pPHBegin, count);
323 placeholder[count] = '\0';
324 ldid = atoi(placeholder);
327 done = SETUPX_TranslateLDID(ldid, pDst, 256);
329 pDst += strlen(pDst);
332 { /* hmm, string placeholder. Need to look up
333 in the [strings] section of the hInf */
335 char buf[256]; /* long enough ? */
337 ret = GetPrivateProfileStringA("strings", placeholder, "",
338 buf, 256, IP_GetFileName(hInf));
346 ERR("placeholder string '%s' not found !\n", placeholder);
351 { /* copy raw placeholder string over */
352 count = (int)p - (int)pPHBegin + 2;
353 strncpy(pDst, pPHBegin-1, count);
362 /* copy the remaining source string over */
363 strncpy(pDst, pSrc, (int)pSrcEnd - (int)pSrc + 1);
366 TRACE("ret '%s'\n", szDst);
369 RETERR16 WINAPI CtlGetLddPath16(LOGDISKID16 ldid, LPSTR szPath)
371 FIXME("(%04x, %p), stub.\n", ldid, szPath);
372 strcpy(szPath, "FIXME_BogusLddPath");
376 RETERR16 WINAPI CtlSetLddPath16(LOGDISKID16 ldid, LPSTR szPath)
378 FIXME("(%04x, '%s'), stub.\n", ldid, szPath);
382 RETERR16 WINAPI vcpOpen16(LPWORD p1, LPWORD p2)
384 FIXME("(%p, %p), stub.\n", p1, p2);
388 RETERR16 WINAPI vcpClose16(WORD w1, WORD w2, WORD w3)
390 FIXME("(%04x, %04x %04x), stub.\n", w1, w2, w3);
394 RETERR16 WINAPI GenInstall16(HINF16 hInfFile, LPCSTR szInstallSection, WORD wFlags)
396 FIXME("(%04x, '%s', %04x), stub. This doesn't install anything yet !\n", hInfFile, szInstallSection, wFlags);