- Timestamp:
- May 15, 2002, 2:39:57 PM (23 years ago)
- Location:
- trunk/src/setupapi
- Files:
-
- 8 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/setupapi/LICENSE.TXT
r6379 r8421 1 $Id: LICENSE.TXT,v 1. 2 2001-07-21 08:50:31sandervl Exp $2 @cThis is an additional Odin license agreement.3 @cIt supercedes the main Odin license, but is only valid in4 @cthe source directory in which it is present.1 $Id: LICENSE.TXT,v 1.3 2002-05-15 12:39:53 sandervl Exp $ 2 This is an additional Odin license agreement. 3 It supercedes the main Odin license, but is only valid in 4 the source directory in which it is present. 5 5 6 @c This file is processed by GNU's TeXinfo 7 @c If you modify it or move it to another location, make sure that 8 @c TeXinfo works (type `make' in directory documentation). 9 10 Copyright (c) 1993-2000 the Wine project authors (see the file AUTHORS 6 Copyright (c) 1993-2002 the Wine project authors (see the file AUTHORS 11 7 for a complete list) 12 8 13 Permission is hereby granted, free of charge, to any person obtaining a copy 14 of this software and associated documentation files (the "Software"), to deal 15 in the Software without restriction, including without limitation the rights 16 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 copies of the Software, and to permit persons to whom the Software is 18 furnished to do so, subject to the following conditions: 9 Wine is free software; you can redistribute it and/or modify it under 10 the terms of the GNU Lesser General Public License as published by the 11 Free Software Foundation; either version 2.1 of the License, or (at 12 your option) any later version. 19 13 20 The above copyright notice and this permission notice shall be included in 21 all copies or substantial portions of the Software. 14 This program is distributed in the hope that it will be useful, but 15 WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 22 18 23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 27 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 A copy of the GNU Lesser General Public License is included in the 20 Wine distribution in the file COPYING.LIB. If you did not receive this 21 copy, write to the Free Software Foundation, Inc., 59 Temple Place, 22 Suite 330, Boston, MA 02111-1307 USA. -
trunk/src/setupapi/devinst.c
r6712 r8421 2 2 * SetupAPI device installer 3 3 * 4 * Copyright 2000 Andreas Mohr for Codeweavers 5 * 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. 10 * 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. 15 * 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 4 19 */ 5 20 6 #include "debugtools.h"7 21 #include "windef.h" 22 #include "winbase.h" 8 23 #include "setupx16.h" 9 #include " heap.h"24 #include "wine/debug.h" 10 25 11 DEFAULT_DEBUG_CHANNEL(setupapi);26 WINE_DEFAULT_DEBUG_CHANNEL(setupapi); 12 27 13 28 /*********************************************************************** -
trunk/src/setupapi/infparse.c
r6712 r8421 1 1 /* 2 2 * SetupX .inf file parsing functions 3 * 4 * Copyright 2000 Andreas Mohr for Codeweavers 5 * 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. 10 * 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. 15 * 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 3 19 * 4 20 * FIXME: … … 10 26 */ 11 27 12 #include "debugtools.h"28 #include <string.h> 13 29 #include "windef.h" 14 30 #include "winbase.h" 15 #include " heap.h"31 #include "ntddk.h" 16 32 #include "wine/winbase16.h" 33 #include "setupapi.h" 17 34 #include "setupx16.h" 18 #include "setupx_private.h" 19 20 DEFAULT_DEBUG_CHANNEL(setupx); 35 #include "setupapi_private.h" 36 #include "wine/debug.h" 37 38 WINE_DEFAULT_DEBUG_CHANNEL(setupapi); 39 40 #define MAX_HANDLES 16384 41 #define FIRST_HANDLE 32 42 43 static HINF handles[MAX_HANDLES]; 44 45 46 static RETERR16 alloc_hinf16( HINF hinf, HINF16 *hinf16 ) 47 { 48 int i; 49 for (i = 0; i < MAX_HANDLES; i++) 50 { 51 if (!handles[i]) 52 { 53 handles[i] = hinf; 54 *hinf16 = i + FIRST_HANDLE; 55 return OK; 56 } 57 } 58 return ERR_IP_OUT_OF_HANDLES; 59 } 60 61 static HINF get_hinf( HINF16 hinf16 ) 62 { 63 int idx = hinf16 - FIRST_HANDLE; 64 if (idx < 0 || idx >= MAX_HANDLES) return 0; 65 return handles[idx]; 66 } 67 68 69 static HINF free_hinf16( HINF16 hinf16 ) 70 { 71 HINF ret; 72 int idx = hinf16 - FIRST_HANDLE; 73 74 if (idx < 0 || idx >= MAX_HANDLES) return 0; 75 ret = handles[idx]; 76 handles[idx] = 0; 77 return ret; 78 } 79 80 /* convert last error code to a RETERR16 value */ 81 static RETERR16 get_last_error(void) 82 { 83 switch(GetLastError()) 84 { 85 case ERROR_EXPECTED_SECTION_NAME: 86 case ERROR_BAD_SECTION_NAME_LINE: 87 case ERROR_SECTION_NAME_TOO_LONG: return ERR_IP_INVALID_SECT_NAME; 88 case ERROR_SECTION_NOT_FOUND: return ERR_IP_SECT_NOT_FOUND; 89 case ERROR_LINE_NOT_FOUND: return ERR_IP_LINE_NOT_FOUND; 90 default: return IP_ERROR; /* FIXME */ 91 } 92 } 93 94 95 /*********************************************************************** 96 * IpOpen (SETUPX.2) 97 * 98 */ 99 RETERR16 WINAPI IpOpen16( LPCSTR filename, HINF16 *hinf16 ) 100 { 101 HINF hinf = SetupOpenInfFileA( filename, NULL, INF_STYLE_WIN4, NULL ); 102 if (hinf == (HINF)INVALID_HANDLE_VALUE) return get_last_error(); 103 return alloc_hinf16( hinf, hinf16 ); 104 } 105 106 107 /*********************************************************************** 108 * IpClose (SETUPX.4) 109 */ 110 RETERR16 WINAPI IpClose16( HINF16 hinf16 ) 111 { 112 HINF hinf = free_hinf16( hinf16 ); 113 if (!hinf) return ERR_IP_INVALID_HINF; 114 SetupCloseInfFile( hinf ); 115 return OK; 116 } 117 118 119 /*********************************************************************** 120 * IpGetProfileString (SETUPX.210) 121 */ 122 RETERR16 WINAPI IpGetProfileString16( HINF16 hinf16, LPCSTR section, LPCSTR entry, 123 LPSTR buffer, WORD buflen ) 124 { 125 DWORD required_size; 126 HINF hinf = get_hinf( hinf16 ); 127 128 if (!hinf) return ERR_IP_INVALID_HINF; 129 if (!SetupGetLineTextA( NULL, hinf, section, entry, buffer, buflen, &required_size )) 130 return get_last_error(); 131 TRACE("%p: section %s entry %s ret %s\n", 132 hinf, debugstr_a(section), debugstr_a(entry), debugstr_a(buffer) ); 133 return OK; 134 } 135 136 137 /*********************************************************************** 138 * GenFormStrWithoutPlaceHolders (SETUPX.103) 139 * 140 * ought to be pretty much implemented, I guess... 141 */ 142 void WINAPI GenFormStrWithoutPlaceHolders16( LPSTR dst, LPCSTR src, HINF16 hinf16 ) 143 { 144 UNICODE_STRING srcW; 145 HINF hinf = get_hinf( hinf16 ); 146 147 if (!hinf) return; 148 149 if (!RtlCreateUnicodeStringFromAsciiz( &srcW, src )) return; 150 PARSER_string_substA( hinf, srcW.Buffer, dst, MAX_INF_STRING_LENGTH ); 151 RtlFreeUnicodeString( &srcW ); 152 TRACE( "%s -> %s\n", debugstr_a(src), debugstr_a(dst) ); 153 } 154 155 /*********************************************************************** 156 * GenInstall (SETUPX.101) 157 * 158 * generic installer function for .INF file sections 159 * 160 * This is not perfect - patch whenever you can ! 161 * 162 * wFlags == GENINSTALL_DO_xxx 163 * e.g. NetMeeting: 164 * first call GENINSTALL_DO_REGSRCPATH | GENINSTALL_DO_FILES, 165 * second call GENINSTALL_DO_LOGCONFIG | CFGAUTO | INI2REG | REG | INI 166 */ 167 RETERR16 WINAPI GenInstall16( HINF16 hinf16, LPCSTR section, WORD genflags ) 168 { 169 UINT flags = 0; 170 HINF hinf = get_hinf( hinf16 ); 171 RETERR16 ret = OK; 172 void *context; 173 174 if (!hinf) return ERR_IP_INVALID_HINF; 175 176 if (genflags & GENINSTALL_DO_FILES) flags |= SPINST_FILES; 177 if (genflags & GENINSTALL_DO_INI) flags |= SPINST_INIFILES; 178 if (genflags & GENINSTALL_DO_REG) flags |= SPINST_REGISTRY; 179 if (genflags & GENINSTALL_DO_INI2REG) flags |= SPINST_INI2REG; 180 if (genflags & GENINSTALL_DO_LOGCONFIG) flags |= SPINST_LOGCONFIG; 181 if (genflags & (GENINSTALL_DO_REGSRCPATH|GENINSTALL_DO_CFGAUTO|GENINSTALL_DO_PERUSER)) 182 FIXME( "unsupported flags %x\n", genflags ); 183 184 context = SetupInitDefaultQueueCallback( 0 ); 185 if (!SetupInstallFromInfSectionA( 0, hinf, section, flags, 0, NULL, 0, 186 SetupDefaultQueueCallbackA, context, 0, 0 )) 187 ret = get_last_error(); 188 189 SetupTermDefaultQueueCallback( context ); 190 return ret; 191 } 192 21 193 22 194 WORD InfNumEntries = 0; … … 24 196 HINF16 IP_curr_handle = 0; 25 197 26 RETERR16 IP_OpenInf(LPCSTR lpInfFileName, HINF16 *lphInf)27 {28 HFILE hFile = _lopen(lpInfFileName, OF_READ);29 30 if (!lphInf)31 return IP_ERROR;32 33 /* this could be improved by checking for already freed handles */34 if (IP_curr_handle == 0xffff)35 return ERR_IP_OUT_OF_HANDLES;36 37 if (hFile != HFILE_ERROR)38 {39 InfList = HeapReAlloc(GetProcessHeap(), 0, InfList, InfNumEntries+1);40 InfList[InfNumEntries].hInf = IP_curr_handle++;41 InfList[InfNumEntries].hInfFile = hFile;42 InfList[InfNumEntries].lpInfFileName = HeapAlloc( GetProcessHeap(), 0,43 strlen(lpInfFileName)+1);44 strcpy( InfList[InfNumEntries].lpInfFileName, lpInfFileName );45 *lphInf = InfList[InfNumEntries].hInf;46 InfNumEntries++;47 TRACE("ret handle %d.\n", *lphInf);48 return OK;49 }50 *lphInf = 0xffff;51 return ERR_IP_INVALID_INFFILE;52 }53 198 54 199 BOOL IP_FindInf(HINF16 hInf, WORD *ret) … … 76 221 } 77 222 78 RETERR16 IP_CloseInf(HINF16 hInf) 79 { 80 int i; 81 WORD n; 82 RETERR16 res = ERR_IP_INVALID_HINF; 83 84 if (IP_FindInf(hInf, &n)) 85 { 86 _lclose(InfList[n].hInfFile); 87 HeapFree(GetProcessHeap(), 0, InfList[n].lpInfFileName); 88 for (i=n; i < InfNumEntries-1; i++) 89 InfList[i] = InfList[i+1]; 90 InfNumEntries--; 91 InfList = HeapReAlloc(GetProcessHeap(), 0, InfList, InfNumEntries); 92 res = OK; 93 } 94 return res; 95 } 96 97 /*********************************************************************** 98 * IpOpen16 99 * 100 */ 101 RETERR16 WINAPI IpOpen16(LPCSTR lpInfFileName, HINF16 *lphInf) 102 { 103 TRACE("('%s', %p)\n", lpInfFileName, lphInf); 104 return IP_OpenInf(lpInfFileName, lphInf); 105 } 106 107 /*********************************************************************** 108 * IpClose16 109 */ 110 RETERR16 WINAPI IpClose16(HINF16 hInf) 111 { 112 return IP_CloseInf(hInf); 113 } 114 115 /*********************************************************************** 116 * IpGetProfileString16 117 */ 118 RETERR16 WINAPI IpGetProfileString16(HINF16 hInf, LPCSTR section, LPCSTR entry, LPSTR buffer, WORD buflen) 119 { 120 TRACE("'%s': section '%s' entry '%s'\n", IP_GetFileName(hInf), section, entry); 121 GetPrivateProfileStringA(section, entry, "", buffer, buflen, IP_GetFileName(hInf)); 122 return 0; 123 } 223 -
trunk/src/setupapi/makefile
r4989 r8421 1 # $Id: makefile,v 1. 1 2001-01-20 18:06:12sandervl Exp $1 # $Id: makefile,v 1.2 2002-05-15 12:39:55 sandervl Exp $ 2 2 3 3 # … … 18 18 # 19 19 OBJS = \ 20 $(OBJDIR)\devinst.obj \ 21 $(OBJDIR)\dirid.obj \ 22 $(OBJDIR)\infparse.obj \ 23 $(OBJDIR)\install.obj \ 24 $(OBJDIR)\parser.obj \ 25 $(OBJDIR)\queue.obj \ 20 26 $(OBJDIR)\stubs.obj \ 27 ##$(OBJDIR)\virtcopy.obj \ 21 28 $(OBJDIR)\setupapirsrc.obj \ 22 29 $(DLLENTRY) … … 28 35 LIBS = \ 29 36 $(ODIN32_LIB)/kernel32.lib \ 37 $(ODIN32_LIB)/user32.lib \ 38 $(ODIN32_LIB)/gdi32.lib \ 39 $(ODIN32_LIB)/ntdll.lib \ 30 40 $(ODIN32_LIB)/ole32.lib \ 31 41 $(ODIN32_LIB)/$(ODINCRT).lib \ -
trunk/src/setupapi/setupx16.h
r4989 r8421 1 /* 2 * Copyright 2000 Andreas Mohr for Codeweavers 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 1 19 #ifndef __SETUPX16_H 2 20 #define __SETUPX16_H … … 6 24 typedef UINT16 HINF16; 7 25 typedef UINT16 LOGDISKID16; 26 typedef UINT16 VHSTR; 8 27 9 28 #define LINE_LEN 256 … … 19 38 #define DI_ERROR (UINT16)500 20 39 21 enum _IP_ERR{40 enum { 22 41 ERR_IP_INVALID_FILENAME = IP_ERROR+1, 23 42 ERR_IP_ALLOC_ERR, … … 38 57 }; 39 58 40 enum _ERR_VCP { 59 /****** virtual copy operations ******/ 60 61 typedef DWORD LPEXPANDVTBL; 62 63 typedef struct { 64 DWORD dwSoFar; 65 DWORD dwTotal; 66 } VCPPROGRESS, *LPVCPPROGRESS; 67 68 typedef struct { 69 WORD cbSize; 70 LOGDISKID16 ldid; 71 VHSTR vhstrRoot; 72 VHSTR vhstrVolumeLabel; 73 VHSTR vhstrDiskName; 74 WORD wVolumeTime; 75 WORD wVolumeDate; 76 DWORD dwSerialNumber; 77 WORD fl; 78 LPARAM lparamRef; 79 80 VCPPROGRESS prgFileRead; 81 VCPPROGRESS prgByteRead; 82 83 VCPPROGRESS prgFileWrite; 84 VCPPROGRESS prgByteWrite; 85 } VCPDISKINFO, *LPVCPDISKINFO; 86 87 typedef struct { 88 LOGDISKID16 ldid; 89 VHSTR vhstrDir; 90 VHSTR vhstrFileName; 91 } VCPFILESPEC, *LPVCPFILESPEC; 92 93 typedef struct { 94 UINT16 uiMDate; 95 UINT16 uiMTime; 96 UINT16 uiADate; 97 UINT16 uiATime; 98 UINT16 uiAttr; 99 DWORD llenIn; 100 DWORD llenOut; 101 } VCPFATTR, *LPVCPFATTR; 102 103 typedef struct { 104 UINT16 uDate; 105 UINT16 uTime; 106 DWORD dwSize; 107 } VCPFILESTAT, *LPVCPFILESTAT; 108 109 typedef struct 110 { 111 HFILE16 hFileSrc; 112 HFILE16 hFileDst; 113 VCPFATTR fAttr; 114 WORD dosError; 115 VHSTR vhstrFileName; 116 WPARAM vcpm; 117 } VIRTNODEEX, *LPVIRTNODEEX; 118 119 typedef struct { 120 WORD cbSize; 121 VCPFILESPEC vfsSrc; 122 VCPFILESPEC vfsDst; 123 WORD fl; 124 LPARAM lParam; 125 LPEXPANDVTBL lpExpandVtbl; 126 LPVIRTNODEEX lpvnex; 127 VHSTR vhstrDstFinalName; 128 VCPFILESTAT vFileStat; 129 } VIRTNODE, *LPVIRTNODE; 130 131 typedef struct { 132 WORD cbSize; 133 VCPPROGRESS prgDiskRead; 134 VCPPROGRESS prgFileRead; 135 VCPPROGRESS prgByteRead; 136 137 VCPPROGRESS prgDiskWrite; 138 VCPPROGRESS prgFileWrite; 139 VCPPROGRESS prgByteWrite; 140 141 LPVCPDISKINFO lpvdiIn; 142 LPVCPDISKINFO lpvdiOut; 143 LPVIRTNODE lpvn; 144 } VCPSTATUS, *LPVCPSTATUS; 145 146 #define CNFL_BACKUP 0x0001 147 #define CNFL_DELETEONFAILURE 0x0002 148 #define CNFL_RENAMEONSUCCESS 0x0004 149 #define CNFL_CONTINUATION 0x0008 150 #define CNFL_SKIPPED 0x0010 151 #define CNFL_IGNOREERRORS 0x0020 152 #define CNFL_RETRYFILE 0x0040 153 #define CNFL_COPIED 0x0080 154 #define VNFL_UNIQUE 0x0000 155 #define VNFL_MULTIPLEOK 0x0100 156 #define VNFL_DESTROYOLD 0x0200 157 #define VNFL_COPY 0x0000 158 #define VNFL_DELETE 0x0800 159 #define VNFL_RENAME 0x1000 160 #define VNFL_NODE_TYPE (VNFL_RENAME|VNFL_DELETE|VNFL_COPY) 161 #define VNFL_CREATED 0x2000 162 #define VNFL_REJECTED 0x4000 163 #define VNFL_DEVICEINSTALLER 0x8000 164 165 enum { 41 166 ERR_VCP_IOFAIL = VCP_ERROR+1, 42 167 ERR_VCP_STRINGTOOLONG, … … 65 190 ERR_VCP_NO_DIGITAL_SIGNATURE_FILE 66 191 }; 192 193 #define VCPN_OK 0 194 #define VCPN_PROCEED 0 195 #define VCPN_ABORT -1 196 #define VCPN_RETRY -2 197 #define VCPN_IGNORE -3 198 #define VCPN_SKIP -4 199 #define VCPN_FORCE -5 200 #define VCPN_DEFER -6 201 #define VCPN_FAIL -7 202 #define VCPN_RETRYFILE -8 203 204 #define VCPFL_ABANDON 0x00 205 #define VCPFL_BACKUP 0x01 206 #define VCPFL_COPY 0x02 207 #define VCPFL_BACKUPANDCOPY (VCPFL_BACKUP|VCPFL_COPY) 208 #define VCPFL_INSPECIFIEDORDER 0x04 209 #define VCPFL_DELETE 0x08 210 #define VCPFL_RENAME 0x10 211 #define VCPFL_ALL (VCPFL_COPY|VCPFL_DELETE|VCPFL_RENAME) 212 213 #define CFNL_BACKUP 0x0001 214 #define CFNL_DELETEONFAILURE 0x0002 215 #define CFNL_RENAMEONSUCCESS 0x0004 216 #define CFNL_CONTINUATION 0x0008 217 #define CFNL_SKIPPED 0x0010 218 #define CFNL_IGNOREERRORS 0x0020 219 #define CFNL_RETRYFILE 0x0040 220 #define CFNL_COPIED 0x0080 221 #define VFNL_MULTIPLEOK 0x0100 222 #define VFNL_DESTROYOLD 0x0200 223 #define VFNL_NOW 0x0400 224 #define VFNL_COPY 0x0000 225 #define VFNL_DELETE 0x0800 226 #define VFNL_RENAME 0x1000 227 #define VFNL_CREATED 0x2000 228 #define VFNL_REJECTED 0x4000 229 #define VCPM_DISKCLASS 0x01 230 #define VCPM_DISKFIRST 0x0100 231 #define VCPM_DISKLAST 0x01ff 232 233 enum { 234 VCPM_DISKCREATEINFO = VCPM_DISKFIRST, 235 VCPM_DISKGETINFO, 236 VCPM_DISKDESTROYINFO, 237 VCPM_DISKPREPINFO, 238 VCPM_DISKENSURE, 239 VCPM_DISKPROMPT, 240 VCPM_DISKFORMATBEGIN, 241 VCPM_DISKFORMATTING, 242 VCPM_DISKFORMATEND 243 }; 244 245 #define VCPM_FILEINCLASS 0x02 246 #define VCPM_FILEOUTCLASS 0x03 247 #define VCPM_FILEFIRSTIN 0x0200 248 #define VCPM_FILEFIRSTOUT 0x0300 249 #define VCPM_FILELAST 0x03ff 250 251 enum { 252 VCPM_FILEOPENIN = VCPM_FILEFIRSTIN, 253 VCPM_FILEGETFATTR, 254 VCPM_FILECLOSEIN, 255 VCPM_FILECOPY, 256 VCPM_FILENEEDED, 257 258 VCPM_FILEOPENOUT = VCPM_FILEFIRSTOUT, 259 VCPM_FILESETFATTR, 260 VCPM_FILECLOSEOUT, 261 VCPM_FILEFINALIZE, 262 VCPM_FILEDELETE, 263 VCPM_FILERENAME 264 }; 265 266 #define VCPM_NODECLASS 0x04 267 #define VCPM_NODEFIRST 0x0400 268 #define VCPM_NODELAST 0x04ff 269 270 enum { 271 VCPM_NODECREATE = VCPM_NODEFIRST, 272 VCPM_NODEACCEPT, 273 VCPM_NODEREJECT, 274 VCPM_NODEDESTROY, 275 VCPM_NODECHANGEDESTDIR, 276 VCPM_NODECOMPARE 277 }; 278 279 #define VCPM_TALLYCLASS 0x05 280 #define VCPM_TALLYFIRST 0x0500 281 #define VCPM_TALLYLAST 0x05ff 282 283 enum { 284 VCPM_TALLYSTART = VCPM_TALLYFIRST, 285 VCPM_TALLYEND, 286 VCPM_TALLYFILE, 287 VCPM_TALLYDISK 288 }; 289 290 #define VCPM_VERCLASS 0x06 291 #define VCPM_VERFIRST 0x0600 292 #define VCPM_VERLAST 0x06ff 293 294 enum { 295 VCPM_VERCHECK = VCPM_VERFIRST, 296 VCPM_VERCHECKDONE, 297 VCPM_VERRESOLVECONFLICT 298 }; 299 300 #define VCPM_VSTATCLASS 0x07 301 #define VCPM_VSTATFIRST 0x0700 302 #define VCPM_VSTATLAST 0x07ff 303 304 enum { 305 VCPM_VSTATSTART = VCPM_VSTATFIRST, 306 VCPM_VSTATEND, 307 VCPM_VSTATREAD, 308 VCPM_VSTATWRITE, 309 VCPM_VSTATNEWDISK, 310 VCPM_VSTATCLOSESTART, 311 VCPM_VSTATCLOSEEND, 312 VCPM_VSTATBACKUPSTART, 313 VCPM_VSTATBACKUPEND, 314 VCPM_VSTATRENAMESTART, 315 VCPM_VSTATRENAMEEND, 316 VCPM_VSTATCOPYSTART, 317 VCPM_VSTATCOPYEND, 318 VCPM_VSTATDELETESTART, 319 VCPM_VSTATDELETEEND, 320 VCPM_VSTATPATHCHECKSTART, 321 VCPM_VSTATPATHCHECKEND, 322 VCPM_VSTATCERTIFYSTART, 323 VCPM_VSTATCERTIFYEND, 324 VCPM_VSTATUSERABORT, 325 VCPM_VSTATYIELD 326 }; 327 328 #define VCPM_PATHCLASS 0x08 329 #define VCPM_PATHFIRST 0x0800 330 #define VCPM_PATHLAST 0x08ff 331 332 enum { 333 VCPM_BUILDPATH = VCPM_PATHFIRST, 334 VCPM_UNIQUEPATH, 335 VCPM_CHECKPATH 336 }; 337 338 #define VCPM_PATCHCLASS 0x09 339 #define VCPM_PATCHFIRST 0x0900 340 #define VCPM_PATCHLAST 0x09ff 341 342 enum { 343 VCPM_FILEPATCHBEFORECPY = VCPM_PATCHFIRST, 344 VCPM_FILEPATCHAFTERCPY, 345 VCPM_FILEPATCHINFOPEN, 346 VCPM_FILEPATCHINFCLOSE 347 }; 348 349 #define VCPM_CERTCLASS 0x0a 350 #define VCPM_CERTFIRST 0x0a00 351 #define VCPM_CERTLAST 0x0aff 352 353 enum { 354 VCPM_FILECERTIFY = VCPM_CERTFIRST, 355 VCPM_FILECERTIFYWARN 356 }; 357 358 #ifdef __WIN32OS2__ 359 typedef LRESULT (* CALLBACK VIFPROC)(LPVOID lpvObj, UINT16 uMsg, WPARAM wParam, LPARAM lParam, LPARAM lparamRef); 360 typedef int (* CALLBACK VCPENUMPROC)(LPVIRTNODE lpvn, LPARAM lparamRef); 361 #else 362 typedef LRESULT (CALLBACK *VIFPROC)(LPVOID lpvObj, UINT16 uMsg, WPARAM wParam, LPARAM lParam, LPARAM lparamRef); 363 typedef int (CALLBACK *VCPENUMPROC)(LPVIRTNODE lpvn, LPARAM lparamRef); 364 #endif 365 366 RETERR16 WINAPI VcpOpen16(VIFPROC vifproc, LPARAM lparamMsgRef); 367 RETERR16 WINAPI VcpQueueCopy16( 368 LPCSTR lpszSrcFileName, LPCSTR lpszDstFileName, 369 LPCSTR lpszSrcDir, LPCSTR lpszDstDir, 370 LOGDISKID16 ldidSrc, LOGDISKID16 ldidDst, 371 LPEXPANDVTBL lpExpandVtbl, 372 WORD fl, LPARAM lParam 373 ); 374 RETERR16 VcpFlush16(WORD fl, LPCSTR lpszBackupDest); 375 RETERR16 WINAPI VcpClose16(WORD fl, LPCSTR lpszBackupDest); 376 377 /* VcpExplain flags */ 378 enum { 379 VCPEX_SRC_DISK, 380 VCPEX_SRC_CABINET, 381 VCPEX_SRC_LOCN, 382 VCPEX_DST_LOCN, 383 VCPEX_SRC_FILE, 384 VCPEX_DST_FILE, 385 VCPEX_DST_FILE_FINAL, 386 VCPEX_DOS_ERROR, 387 VCPEX_MESSAGE, 388 VCPEX_DOS_SOLUTION, 389 VCPEX_SRC_FULL, 390 VCPEX_DST_FULL, 391 VCPEX_DST_FULL_FINAL 392 }; 393 394 LPCSTR WINAPI VcpExplain16(LPVIRTNODE lpVn, DWORD dwWhat); 67 395 68 396 /****** logical disk management ******/ … … 199 527 200 528 201 typedef LRESULT (CALLBACK *VIFPROC)(LPVOID lpvObj, UINT uMsg, WPARAM wParam, LPARAM lParam, LPARAM lparamRef);202 203 529 extern void WINAPI GenFormStrWithoutPlaceHolders16(LPSTR,LPCSTR,HINF16); 204 530 extern RETERR16 WINAPI IpOpen16(LPCSTR,HINF16 *); … … 209 535 extern RETERR16 WINAPI CtlAddLdd16(LPLOGDISKDESC); 210 536 extern RETERR16 WINAPI CtlDelLdd16(LOGDISKID16); 537 extern RETERR16 WINAPI CtlGetLddPath16(LOGDISKID16 ldid, LPSTR szPath); 211 538 extern RETERR16 WINAPI GenInstall16(HINF16,LPCSTR,WORD); 212 539 -
trunk/src/setupapi/setupx_main.c
r6712 r8421 3 3 * 4 4 * Copyright 1998,2000 Andreas Mohr 5 * 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. 10 * 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. 15 * 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 5 19 * 6 20 * FIXME: Rather non-functional functions for now. … … 30 44 * Ip .INF parsing (infparse.c) 31 45 * LDD logical device descriptor (ldd.c ?) 32 * LDID logical device ID 46 * LDID logical device ID 33 47 * SU setup (setup.c ?) 34 48 * Tp text processing (textproc.c ?) … … 44 58 #include <stdlib.h> 45 59 #include <stdio.h> 60 #include <string.h> 46 61 #include "winreg.h" 62 #include "winerror.h" 47 63 #include "wine/winuser16.h" 64 #include "setupapi.h" 48 65 #include "setupx16.h" 49 #include "setup x_private.h"66 #include "setupapi_private.h" 50 67 #include "winerror.h" 51 #include "heap.h" 52 #include "debugtools.h" 53 54 DEFAULT_DEBUG_CHANNEL(setupx); 55 56 /*********************************************************************** 57 * SURegOpenKey 68 #include "wine/debug.h" 69 70 WINE_DEFAULT_DEBUG_CHANNEL(setupapi); 71 72 /*********************************************************************** 73 * SURegOpenKey (SETUPX.47) 58 74 */ 59 75 DWORD WINAPI SURegOpenKey( HKEY hkey, LPCSTR lpszSubKey, LPHKEY retkey ) … … 64 80 65 81 /*********************************************************************** 66 * SURegQueryValueEx 82 * SURegQueryValueEx (SETUPX.50) 67 83 */ 68 84 DWORD WINAPI SURegQueryValueEx( HKEY hkey, LPSTR lpszValueName, … … 123 139 p = q+1; 124 140 } 125 141 126 142 /* put number of entries at beginning of list */ 127 143 *(DWORD *)res = count; … … 141 157 } 142 158 143 static void SETUPX_IsolateSubString(LPSTR *begin, LPSTR *end) 144 { 145 LPSTR p, q; 146 147 p = *begin; 148 q = *end; 149 150 while ((p < q) && ((*p == ' ') || (*p == '\t'))) p++; 151 while ((p < q) && (*p == '"')) p++; 152 153 while ((q-1 >= p) && ((*(q-1) == ' ') || (*(q-1) == '\t'))) q--; 154 while ((q-1 >= p) && (*(q-1) == '"')) q--; 155 156 *begin = p; 157 *end = q; 158 } 159 160 /* 161 * Example: HKLM,"Software\Microsoft\Windows\CurrentVersion","ProgramFilesDir",,"C:\" 162 * FIXME: use SETUPX_GetSubStrings() instead. 163 * Hmm, but on the other hand SETUPX_GetSubStrings() will probably 164 * soon be replaced by InitSubstrData() etc. anyway. 165 * 166 */ 167 static BOOL SETUPX_LookupRegistryString(LPSTR regstr, LPSTR buffer, DWORD buflen) 168 { 169 HANDLE heap = GetProcessHeap(); 170 LPSTR items[5]; 171 LPSTR p, q, next; 172 int len, n; 173 HKEY hkey, hsubkey; 174 DWORD dwType; 175 176 TRACE("retrieving '%s'\n", regstr); 177 178 p = regstr; 179 180 /* isolate root key, subkey, value, flag, defval */ 181 for (n=0; n < 5; n++) 182 { 183 q = strchr(p, ','); 184 if (!q) 185 { 186 if (n == 4) 187 q = p+strlen(p); 188 else 189 return FALSE; 190 } 191 next = q+1; 192 if (q < regstr) 193 return FALSE; 194 SETUPX_IsolateSubString(&p, &q); 195 len = (int)q - (int)p; 196 items[n] = HeapAlloc(heap, 0, len+1); 197 strncpy(items[n], p, len); 198 items[n][len] = '\0'; 199 p = next; 200 } 201 TRACE("got '%s','%s','%s','%s','%s'\n", 202 items[0], items[1], items[2], items[3], items[4]); 203 204 /* check root key */ 205 if (!strcasecmp(items[0], "HKCR")) 206 hkey = HKEY_CLASSES_ROOT; 207 else 208 if (!strcasecmp(items[0], "HKCU")) 209 hkey = HKEY_CURRENT_USER; 210 else 211 if (!strcasecmp(items[0], "HKLM")) 212 hkey = HKEY_LOCAL_MACHINE; 213 else 214 if (!strcasecmp(items[0], "HKU")) 215 hkey = HKEY_USERS; 216 else 217 { /* HKR ? -> relative to key passed to GenInstallEx */ 218 FIXME("unsupported regkey '%s'\n", items[0]); 219 goto regfailed; 220 } 221 222 if (RegOpenKeyA(hkey, items[1], &hsubkey) != ERROR_SUCCESS) 223 goto regfailed; 224 225 if (RegQueryValueExA(hsubkey, items[2], NULL, &dwType, buffer, &buflen) 226 != ERROR_SUCCESS) 227 goto regfailed; 228 goto done; 229 230 regfailed: 231 if (buffer) strcpy(buffer, items[4]); /* I don't care about buflen */ 232 done: 233 for (n=0; n < 5; n++) 234 HeapFree(heap, 0, items[n]); 235 if (buffer) 236 TRACE("return '%s'\n", buffer); 237 return TRUE; 238 } 239 240 static LPSTR SETUPX_GetSections(LPCSTR filename) 241 { 242 LPSTR buf = NULL; 243 DWORD len = 1024, res; 244 245 do { 246 buf = HeapReAlloc(GetProcessHeap(), 0, buf, len); 247 res = GetPrivateProfileStringA(NULL, NULL, NULL, buf, len, filename); 248 len *= 2; 249 } while ((!res) && (len < 1048576)); 250 if (!res) 251 { 252 HeapFree(GetProcessHeap(), 0, buf); 253 return NULL; 254 } 255 return buf; 256 } 257 258 static LPSTR SETUPX_GetSectionEntries(LPCSTR filename, LPCSTR section) 259 { 260 LPSTR buf = NULL; 261 DWORD len = 1024, res; 262 263 do { 264 buf = HeapReAlloc(GetProcessHeap(), 0, buf, len); 265 res = GetPrivateProfileSectionA(section, buf, len, filename); 266 len *= 2; 267 } while ((!res) && (len < 1048576)); 268 if (!res) 269 { 270 HeapFree(GetProcessHeap(), 0, buf); 271 return NULL; 272 } 273 return buf; 274 } 275 276 277 /*********************************************************************** 278 * InstallHinfSection 159 160 /*********************************************************************** 161 * InstallHinfSection (SETUPX.527) 279 162 * 280 163 * hwnd = parent window … … 283 166 * Here "DefaultInstall" is the .inf file section to be installed (optional). 284 167 * The 132 value is made of the HOW_xxx flags and sometimes 128 (-> setupx16.h). 285 * 168 * 286 169 * nCmdShow = nCmdShow of CreateProcess 287 170 */ 288 typedef INT WINAPI (*MSGBOX_PROC)( HWND, LPCSTR, LPCSTR, UINT );289 171 RETERR16 WINAPI InstallHinfSection16( HWND16 hwnd, HINSTANCE16 hinst, LPCSTR lpszCmdLine, INT16 nCmdShow) 290 172 { … … 292 174 DWORD count; 293 175 HINF16 hInf = 0; 294 RETERR16 res = OK ;176 RETERR16 res = OK, tmp; 295 177 WORD wFlags; 296 178 BOOL reboot = FALSE; 297 HMODULE hMod; 298 MSGBOX_PROC pMessageBoxA; 299 179 300 180 TRACE("(%04x, %04x, %s, %d);\n", hwnd, hinst, lpszCmdLine, nCmdShow); 301 181 302 182 pSub = SETUPX_GetSubStrings((LPSTR)lpszCmdLine, ' '); 303 183 … … 310 190 goto end; 311 191 } 192 if (VcpOpen16(NULL, 0)) 193 goto end; 312 194 if (GenInstall16(hInf, *(pSub+count-2), GENINSTALL_DO_ALL) != OK) 313 195 goto end; … … 321 203 case HOW_ALWAYS_PROMPT_REBOOT: 322 204 case HOW_PROMPT_REBOOT: 323 if ((hMod = GetModuleHandleA("user32.dll"))) 324 { 325 if ((pMessageBoxA = (MSGBOX_PROC)GetProcAddress( hMod, "MessageBoxA" ))) 326 { 327 328 if (pMessageBoxA(hwnd, "You must restart Wine before the new settings will take effect.\n\nDo you want to exit Wine now ?", "Systems Settings Change", MB_YESNO|MB_ICONQUESTION) == IDYES) 329 reboot = TRUE; 330 } 331 } 205 if (MessageBoxA(hwnd, "You must restart Wine before the new settings will take effect.\n\nDo you want to exit Wine now ?", "Systems Settings Change", MB_YESNO|MB_ICONQUESTION) == IDYES) 206 reboot = TRUE; 332 207 break; 333 208 default: … … 335 210 goto end; 336 211 } 337 212 338 213 res = OK; 339 214 end: 340 IpClose16(hInf); 215 tmp = VcpClose16(VCPFL_ALL, NULL); 216 if (tmp != OK) 217 res = tmp; 218 tmp = IpClose16(hInf); 219 if (tmp != OK) 220 res = tmp; 341 221 SETUPX_FreeSubStrings(pSub); 342 222 if (reboot) … … 497 377 }; 498 378 499 /* 379 /* 500 380 * LDD == Logical Device Descriptor 501 381 * LDID == Logical Device ID 502 382 * 503 383 * The whole LDD/LDID business might go into a separate file named 504 * ldd.c or logdevice.c.384 * ldd.c. 505 385 * At the moment I don't know what the hell these functions are really doing. 506 386 * That's why I added reporting stubs. … … 575 455 if (hKey) RegCloseKey(hKey); 576 456 } 577 457 578 458 /*********************************************************************** 579 459 * CtlDelLdd (SETUPX.37) … … 613 493 pFirstLDD = NULL; 614 494 HeapFree(GetProcessHeap(), 0, pCurr); 615 495 616 496 return OK; 617 497 } … … 634 514 * ERR_VCP_LDDINVALID if pldd->cbSize != structsize 635 515 * 1 in all other cases ?? 636 * 516 * 637 517 */ 638 518 RETERR16 WINAPI CtlFindLdd16(LPLOGDISKDESC pldd) … … 641 521 642 522 TRACE("(%p)\n", pldd); 643 523 644 524 if (!std_LDDs_done) 645 525 SETUPX_CreateStandardLDDs(); … … 661 541 memcpy(pldd, pCurr->pldd, pldd->cbSize); 662 542 /* hmm, we probably ought to strcpy() the string ptrs here */ 663 543 664 544 return 1; /* what is this ?? */ 665 545 } … … 697 577 pCurr = pCurr->next; 698 578 } 699 if ( pCurr == NULL) /* hit end of list */579 if (!pCurr || pldd->ldid != pCurr->pldd->ldid) 700 580 { 701 581 is_new = TRUE; … … 716 596 717 597 if (pldd->pszPath) 718 pCurrLDD->pszPath = HEAP_strdupA(heap, 0, pldd->pszPath); 598 { 599 pCurrLDD->pszPath = HeapAlloc( heap, 0, strlen(pldd->pszPath)+1 ); 600 strcpy( pCurrLDD->pszPath, pldd->pszPath ); 601 } 719 602 if (pldd->pszVolLabel) 720 pCurrLDD->pszVolLabel = HEAP_strdupA(heap, 0, pldd->pszVolLabel); 603 { 604 pCurrLDD->pszVolLabel = HeapAlloc( heap, 0, strlen(pldd->pszVolLabel)+1 ); 605 strcpy( pCurrLDD->pszVolLabel, pldd->pszVolLabel ); 606 } 721 607 if (pldd->pszDiskName) 722 pCurrLDD->pszDiskName = HEAP_strdupA(heap, 0, pldd->pszDiskName); 608 { 609 pCurrLDD->pszDiskName = HeapAlloc( heap, 0, strlen(pldd->pszDiskName)+1 ); 610 strcpy( pCurrLDD->pszDiskName, pldd->pszDiskName ); 611 } 723 612 724 613 if (is_new) /* link into list */ … … 732 621 pFirstLDD = pCurr; 733 622 } 734 623 735 624 return OK; 736 625 } … … 758 647 * RETURN 759 648 * ERR_VCP_LDDINVALID if pldd->cbSize != structsize 760 * 649 * 761 650 */ 762 651 static RETERR16 SETUPX_GetLdd(LPLOGDISKDESC pldd) … … 830 719 LOGDISKDESC_S ldd; 831 720 TRACE("(%d, '%s');\n", ldid, szPath); 832 721 722 SetupSetDirectoryIdA( 0, ldid, szPath ); 833 723 INIT_LDD(ldd, ldid); 834 724 ldd.pszPath = szPath; 835 725 return CtlSetLdd16(&ldd); 836 726 } 837 838 /*839 * Find the value of a custom LDID in a .inf file840 * e.g. for 49301:841 * 49300,49301=ProgramFilesDir,5842 * -- profile section lookup -->843 * [ProgramFilesDir]844 * HKLM,"Software\Microsoft\Windows\CurrentVersion","ProgramFilesDir",,"%24%"845 * -- GenFormStrWithoutPlaceHolders16 -->846 * HKLM,"Software\Microsoft\Windows\CurrentVersion","ProgramFilesDir",,"C:\"847 * -- registry lookup -->848 * C:\Program Files (or C:\ if not found in registry)849 *850 * FIXME:851 * - maybe we ought to add a caching array for speed ? - I don't care :)852 * - not sure whether the processing is correct - sometimes there are equal853 * LDIDs for both install and removal sections.854 * - probably the whole function can be removed as installers add that on their855 * own856 */857 static BOOL SETUPX_AddCustomLDID(int ldid, INT16 hInf)858 {859 char ldidstr[6];860 LPSTR sectionbuf = NULL, entrybuf = NULL, regsectionbuf = NULL;861 LPCSTR filename;862 LPSTR pSec, pEnt, pEqual, p, *pSub = NULL;863 BOOL ret = FALSE;864 char buffer[MAX_PATH];865 LOGDISKDESC_S ldd;866 867 sprintf(ldidstr, "%d", ldid);868 filename = IP_GetFileName(hInf);869 if (!(sectionbuf = SETUPX_GetSections(filename)))870 {871 ERR("couldn't get sections !\n");872 return FALSE;873 }874 for (pSec=sectionbuf; *pSec; pSec += strlen(pSec)+1)875 {876 if (!(entrybuf = SETUPX_GetSectionEntries(filename, pSec)))877 {878 ERR("couldn't get section entries !\n");879 goto end;880 }881 for (pEnt=entrybuf; *pEnt; pEnt += strlen(pEnt)+1)882 {883 if (strstr(pEnt, ldidstr))884 {885 pEqual = strchr(pEnt, '=');886 if (!pEqual) /* crippled entry ?? */887 continue;888 889 /* make sure we found the LDID on left side of the equation */890 if (pEnt+strlen(ldidstr) <= pEqual)891 { /* found */892 893 /* but we don't want entries in the strings section */894 if (!strcasecmp(pSec, "Strings"))895 goto next_section;896 p = pEqual+1;897 goto found;898 }899 }900 }901 next_section:902 }903 goto end;904 found:905 TRACE("found entry '%s'\n", p);906 pSub = SETUPX_GetSubStrings(p, ',');907 if (*(DWORD *)pSub > 2)908 {909 ERR("malformed entry '%s' ?\n", p);910 goto end;911 }912 TRACE("found section '%s'\n", *(pSub+1));913 /* FIXME: what are the optional flags at the end of an entry used for ?? */914 915 /* get the location of the registry key from that section */916 if (!(regsectionbuf = SETUPX_GetSectionEntries(filename, *(pSub+1))))917 {918 ERR("couldn't get registry section entries !\n");919 goto end;920 }921 /* sectionbuf is > 1024 bytes anyway, so use it */922 GenFormStrWithoutPlaceHolders16(sectionbuf, regsectionbuf, hInf);923 ret = SETUPX_LookupRegistryString(sectionbuf, buffer, MAX_PATH);924 TRACE("return '%s'\n", buffer);925 INIT_LDD(ldd, ldid);926 ldd.pszPath = buffer;927 CtlSetLdd16(&ldd);928 end:929 SETUPX_FreeSubStrings(pSub);930 if (sectionbuf) HeapFree(GetProcessHeap(), 0, sectionbuf);931 if (entrybuf) HeapFree(GetProcessHeap(), 0, entrybuf);932 if (regsectionbuf) HeapFree(GetProcessHeap(), 0, regsectionbuf);933 return ret;934 }935 936 /*937 * Translate a logical disk identifier (LDID) into its string representation938 * I'm afraid this can be totally replaced by CtlGetLddPath().939 */940 static BOOL SETUPX_IP_TranslateLDID(int ldid, LPSTR *p, HINF16 hInf)941 {942 BOOL handled = FALSE;943 LOGDISKDESC_S ldd;944 945 ldd.cbSize = sizeof(LOGDISKDESC_S);946 ldd.ldid = ldid;947 if (CtlFindLdd16(&ldd) == ERR_VCP_LDDFIND)948 {949 /* hmm, it seems the installers already do the work for us950 * (by calling CtlSetLddPath) that SETUPX_AddCustomLDID951 * is supposed to do. Grmbl ;-)952 * Well, I'll leave it here anyway, but print error... */953 ERR("hmm, LDID %d not registered yet !?\n", ldid);954 handled = SETUPX_AddCustomLDID(ldid, hInf);955 }956 else957 handled = TRUE;958 959 SETUPX_GetLdd(&ldd);960 961 if (!handled)962 {963 FIXME("What is LDID %d ??\n", ldid);964 *p = "LDID_FIXME";965 }966 else967 *p = ldd.pszPath;968 969 return handled;970 }971 972 /***********************************************************************973 * GenFormStrWithoutPlaceHolders974 *975 * ought to be pretty much implemented, I guess...976 */977 void WINAPI GenFormStrWithoutPlaceHolders16( LPSTR szDst, LPCSTR szSrc, HINF16 hInf)978 {979 LPCSTR pSrc = szSrc, pSrcEnd = szSrc + strlen(szSrc);980 LPSTR pDst = szDst, p, pPHBegin;981 int count;982 983 TRACE("(%p, '%s', %04x);\n", szDst, szSrc, hInf);984 while (pSrc < pSrcEnd)985 {986 p = strchr(pSrc, '%');987 if (p)988 {989 count = (int)p - (int)pSrc;990 strncpy(pDst, pSrc, count);991 pSrc += count;992 pDst += count;993 pPHBegin = p+1;994 p = strchr(pPHBegin, '%');995 if (p)996 {997 char placeholder[80]; /* that really ought to be enough ;) */998 int ldid;999 BOOL done = TRUE;1000 count = (int)p - (int)pPHBegin;1001 strncpy(placeholder, pPHBegin, count);1002 placeholder[count] = '\0';1003 ldid = atoi(placeholder);1004 if (ldid)1005 {1006 LPSTR p;1007 done = SETUPX_IP_TranslateLDID(ldid, &p, hInf);1008 strcpy(pDst, p);1009 if (done)1010 pDst += strlen(pDst);1011 }1012 else1013 { /* hmm, string placeholder. Need to look up1014 in the [strings] section of the hInf */1015 DWORD ret;1016 char buf[256]; /* long enough ? */1017 1018 ret = GetPrivateProfileStringA("strings", placeholder, "",1019 buf, 256, IP_GetFileName(hInf));1020 if (ret)1021 {1022 strcpy(pDst, buf);1023 pDst += strlen(buf);1024 }1025 else1026 {1027 ERR("placeholder string '%s' not found !\n", placeholder);1028 done = FALSE;1029 }1030 }1031 if (!done)1032 { /* copy raw placeholder string over */1033 count = (int)p - (int)pPHBegin + 2;1034 strncpy(pDst, pPHBegin-1, count);1035 pDst += count;1036 1037 }1038 pSrc = p+1;1039 continue;1040 }1041 }1042 1043 /* copy the remaining source string over */1044 strncpy(pDst, pSrc, (int)pSrcEnd - (int)pSrc + 1);1045 break;1046 }1047 TRACE("ret '%s'\n", szDst);1048 }1049 1050 /***********************************************************************1051 * VcpOpen1052 *1053 * No idea what to do here.1054 */1055 RETERR16 WINAPI VcpOpen16(VIFPROC vifproc, LPARAM lparamMsgRef)1056 {1057 FIXME("(%p, %08lx), stub.\n", vifproc, lparamMsgRef);1058 return OK;1059 }1060 1061 /***********************************************************************1062 * VcpClose1063 *1064 * Is fl related to VCPDISKINFO.fl ?1065 */1066 RETERR16 WINAPI VcpClose16(WORD fl, LPCSTR lpszBackupDest)1067 {1068 FIXME("(%04x, '%s'), stub.\n", fl, lpszBackupDest);1069 return OK;1070 }1071 1072 /*1073 * Copy all items in a CopyFiles entry over to the destination1074 *1075 * - VNLP_xxx is what is given as flags for a .INF CopyFiles section1076 */1077 static BOOL SETUPX_CopyFiles(LPSTR *pSub, HINF16 hInf)1078 {1079 BOOL res = FALSE;1080 unsigned int n;1081 LPCSTR filename = IP_GetFileName(hInf);1082 LPSTR pCopyEntry;1083 char pDestStr[MAX_PATH];1084 LPSTR pSrcDir, pDstDir;1085 LPSTR pFileEntries, p;1086 WORD ldid;1087 LOGDISKDESC_S ldd;1088 LPSTR *pSubFile;1089 LPSTR pSrcFile, pDstFile;1090 1091 for (n=0; n < *(DWORD *)pSub; n++)1092 {1093 pCopyEntry = *(pSub+1+n);1094 if (*pCopyEntry == '@')1095 {1096 ERR("single file not handled yet !\n");1097 continue;1098 }1099 1100 /* get source directory for that entry */1101 INIT_LDD(ldd, LDID_SRCPATH);1102 SETUPX_GetLdd(&ldd);1103 pSrcDir = ldd.pszPath;1104 1105 /* get destination directory for that entry */1106 if (!(GetPrivateProfileStringA("DestinationDirs", pCopyEntry, "",1107 pDestStr, sizeof(pDestStr), filename)))1108 continue;1109 1110 /* translate destination dir if given as LDID */1111 ldid = atoi(pDestStr);1112 if (ldid)1113 {1114 if (!(SETUPX_IP_TranslateLDID(ldid, &pDstDir, hInf)))1115 continue;1116 }1117 else1118 pDstDir = pDestStr;1119 1120 /* now that we have the destination dir, iterate over files to copy */1121 pFileEntries = SETUPX_GetSectionEntries(filename, pCopyEntry);1122 for (p=pFileEntries; *p; p +=strlen(p)+1)1123 {1124 pSubFile = SETUPX_GetSubStrings(p, ',');1125 pSrcFile = *(pSubFile+1);1126 pDstFile = (*(DWORD *)pSubFile > 1) ? *(pSubFile+2) : pSrcFile;1127 TRACE("copying file '%s\\%s' to '%s\\%s'\n", pSrcDir, pSrcFile, pDstDir, pDstFile);1128 if (*(DWORD *)pSubFile > 2)1129 {1130 WORD flag;1131 if ((flag = atoi(*(pSubFile+3)))) /* ah, flag */1132 {1133 if (flag & 0x2c)1134 FIXME("VNLP_xxx flag %d not handled yet.\n", flag);1135 }1136 else1137 FIXME("temp file name '%s' given. Need to register in wininit.ini !\n", *(pSubFile+3)); /* strong guess that this is VcpQueueCopy() */1138 }1139 SETUPX_FreeSubStrings(pSubFile);1140 /* we don't copy ANYTHING yet ! (I'm too lazy and want to verify1141 * this first before destroying whole partitions ;-) */1142 }1143 }1144 1145 return res;1146 }1147 1148 /***********************************************************************1149 * GenInstall1150 *1151 * general install function for .INF file sections1152 *1153 * This is not perfect - patch whenever you can !1154 *1155 * wFlags == GENINSTALL_DO_xxx1156 * e.g. NetMeeting:1157 * first call GENINSTALL_DO_REGSRCPATH | GENINSTALL_DO_FILES,1158 * second call GENINSTALL_DO_LOGCONFIG | CFGAUTO | INI2REG | REG | INI1159 */1160 RETERR16 WINAPI GenInstall16(HINF16 hInfFile, LPCSTR szInstallSection, WORD wFlags)1161 {1162 LPCSTR filename = IP_GetFileName(hInfFile);1163 LPSTR pEntries, p, pEnd;1164 DWORD len;1165 LPSTR *pSub;1166 1167 FIXME("(%04x, '%s', %04x), semi-stub. Please implement additional operations here !\n", hInfFile, szInstallSection, wFlags);1168 pEntries = SETUPX_GetSectionEntries(filename, szInstallSection);1169 if (!pEntries)1170 {1171 ERR("couldn't find entries for section '%s' !\n", szInstallSection);1172 return ERR_IP_SECT_NOT_FOUND;1173 }1174 for (p=pEntries; *p; p +=strlen(p)+1)1175 {1176 pEnd = strchr(p, '=');1177 if (!pEnd) continue;1178 pSub = SETUPX_GetSubStrings(pEnd+1, ','); /* split entries after the '=' */1179 SETUPX_IsolateSubString(&p, &pEnd);1180 len = (int)pEnd - (int)p;1181 1182 if (wFlags & GENINSTALL_DO_FILES)1183 {1184 if (!strncasecmp(p, "CopyFiles", len))1185 {1186 SETUPX_CopyFiles(pSub, hInfFile);1187 continue;1188 }1189 #if IMPLEMENT_THAT1190 else1191 if (!strncasecmp(p, "DelFiles", len))1192 {1193 SETUPX_DelFiles(filename, szInstallSection, pSub);1194 continue;1195 }1196 #endif1197 }1198 if (wFlags & GENINSTALL_DO_INI)1199 {1200 #if IMPLEMENT_THAT1201 if (!strncasecmp(p, "UpdateInis", len))1202 {1203 SETUPX_UpdateInis(filename, szInstallSection, pSub);1204 continue;1205 }1206 #endif1207 }1208 if (wFlags & GENINSTALL_DO_REG)1209 {1210 #if IMPLEMENT_THAT1211 /* probably use SUReg*() functions here */1212 if (!strncasecmp(p, "AddReg", len))1213 {1214 SETUPX_AddReg(filename, szInstallSection, pSub);1215 continue;1216 }1217 else1218 if (!strncasecmp(p, "DelReg", len))1219 {1220 SETUPX_DelReg(filename, szInstallSection, pSub);1221 continue;1222 }1223 #endif1224 }1225 1226 SETUPX_FreeSubStrings(pSub);1227 }1228 HeapFree(GetProcessHeap(), 0, pEntries);1229 return OK;1230 } -
trunk/src/setupapi/stubs.c
r8226 r8421 1 /* -*- tab-width: 8; c-basic-offset: 8 -*- */2 1 /* 3 2 * SetupAPI stubs 4 3 * 4 * Copyright 2000 James Hatheway 5 * 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. 10 * 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. 15 * 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 5 19 */ 6 20 7 #include " debugtools.h"21 #include "wine/debug.h" 8 22 #include "windef.h" 9 #ifdef __WIN32OS2__10 #include "ole2.h"11 #endif12 23 #include "setupapi.h" 13 24 14 DEFAULT_DEBUG_CHANNEL(setupapi);25 WINE_DEFAULT_DEBUG_CHANNEL(setupapi); 15 26 16 27 17 28 /*********************************************************************** 18 * SetupCloseFileQueue 19 */ 20 BOOL WINAPI SetupCloseFileQueue(HSPFILEQ QueueHandle) 21 { 22 FIXME("not implemented (setupapi.dll) \n"); 23 } 24 25 /*********************************************************************** 26 * SetupCommitFileQueueA 27 */ 28 BOOL WINAPI SetupCommitFileQueueA(HWND Owner, HSPFILEQ QueueHandle, 29 PSP_FILE_CALLBACK_A MsgHandler, 30 PVOID Context) 31 { 32 FIXME("not implemented (setupapi.dll) \n"); 33 return FALSE; 34 } 35 36 /*********************************************************************** 37 * SetupIterateCabinetA 29 * SetupIterateCabinetA (SETUPAPI.@) 38 30 */ 39 31 BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, … … 45 37 46 38 /*********************************************************************** 47 * SetupIterateCabinetW 39 * SetupIterateCabinetW (SETUPAPI.@) 48 40 */ 49 41 BOOL WINAPI SetupIterateCabinetW(PWSTR CabinetFile, DWORD Reserved, … … 56 48 57 49 /*********************************************************************** 58 * SetupGetLineTextA50 * TPWriteProfileString (SETUPX.62) 59 51 */ 60 BOOL WINAPI SetupGetLineTextA (const INFCONTEXT *Context, HINF InfHandle, 61 PCSTR Section, PCSTR Key, LPSTR ReturnBuffer, 62 DWORD ReturnBufferSize, PDWORD RequiredSize) 52 BOOL WINAPI TPWriteProfileString16( LPCSTR section, LPCSTR entry, LPCSTR string ) 63 53 { 64 FIXME("not implemented (setupapi.dll) \n"); 65 return 0; 66 } 67 68 /*********************************************************************** 69 * SetupGetStringFieldA 70 */ 71 BOOL WINAPI SetupGetStringFieldA(const INFCONTEXT *Context, DWORD FieldIndex, 72 LPSTR ReturnBuffer, DWORD ReturnBufferSize, 73 PDWORD RequiredSize) 74 { 75 FIXME("not implemented (setupapi.dll) \n"); 76 return 0; 54 FIXME( "%s %s %s: stub\n", debugstr_a(section), debugstr_a(entry), debugstr_a(string) ); 55 return TRUE; 77 56 } 78 57 79 58 80 59 /*********************************************************************** 81 * SetupFindNextLine60 * suErrorToIds (SETUPX.61) 82 61 */ 83 BOOL WINAPI SetupFindNextLine (const INFCONTEXT *ContextIn, PINFCONTEXT ContextOut)62 DWORD WINAPI suErrorToIds16( WORD w1, WORD w2 ) 84 63 { 85 FIXME("not implemented (setupapi.dll) \n");86 64 FIXME( "%x %x: stub\n", w1, w2 ); 65 return 0; 87 66 } 88 89 90 /***********************************************************************91 * SetupInitDefaultQueueCallback92 */93 PVOID WINAPI SetupInitDefaultQueueCallback(HWND OwnerWindow)94 {95 FIXME("not implemented (setupapi.dll) \n");96 return 0;97 }98 99 /***********************************************************************100 * SetupInitDefaultQueueCallbackEx101 */102 PVOID WINAPI SetupInitDefaultQueueCallbackEx(HWND OwnerWindow,103 HWND AlternativeProgressWindow,104 UINT ProgressMessage,105 DWORD res1,106 PVOID res2)107 {108 FIXME("not implemented (setupapi.dll) \n");109 return 0;110 }111 112 /***********************************************************************113 * SetupCloseInfFile114 */115 VOID WINAPI SetupCloseInfFile (HINF InfHandle)116 {117 FIXME("not implemented (setupapi.dll) \n");118 }119 120 121 /***********************************************************************122 * SetupDefaultQueueCallbackA123 */124 UINT WINAPI SetupDefaultQueueCallbackA (PVOID Context, UINT Notification,125 UINT_PTR Param1, UINT_PTR Param2)126 {127 FIXME("not implemented (setupapi.dll) \n");128 return 0;129 }130 131 132 /***********************************************************************133 * SetupFindFirstLineA134 */135 BOOL WINAPI SetupFindFirstLineA (HINF InfHandle, PCSTR Section, PCSTR Key,136 PINFCONTEXT Context)137 {138 FIXME("not implemented (setupapi.dll) \n");139 return 0;140 }141 142 /***********************************************************************143 * SetupGetLineByIndexA144 */145 BOOL WINAPI SetupGetLineByIndexA (HINF InfHandle, PCSTR Section, DWORD Index,146 PINFCONTEXT Context)147 {148 FIXME("not implemented (setupapi.dll) \n");149 return FALSE;150 }151 152 153 /***********************************************************************154 * SetupInstallFromInfSectionA155 */156 BOOL WINAPI SetupInstallFromInfSectionA (HWND Owner, HINF InfHandle, PCSTR SectionName,157 UINT Flags, HKEY RelativeKeyRoot, PCSTR SourceRootPath,158 UINT CopyFlags, PSP_FILE_CALLBACK_A MsgHandler,159 PVOID Context, HDEVINFO DeviceInfoSet,160 PSP_DEVINFO_DATA DeviceInfoData)161 {162 FIXME("not implemented (setupapi.dll) \n");163 return 0;164 }165 166 /***********************************************************************167 * SetupOpenAppendInfFileA168 */169 BOOL WINAPI SetupOpenAppendInfFileA (PCSTR FileName, HINF InfHandle,170 PUINT ErrorLine)171 {172 FIXME("not implemented (setupapi.dll) \n");173 return FALSE;174 }175 176 /***********************************************************************177 * SetupOpenFileQueue178 */179 HSPFILEQ WINAPI SetupOpenFileQueue (VOID)180 {181 FIXME("not implemented (setupapi.dll) \n");182 return (HSPFILEQ) INVALID_HANDLE_VALUE;183 }184 185 /***********************************************************************186 * SetupOpenInfFileA187 */188 HINF WINAPI SetupOpenInfFileA (PCSTR FileName, PCSTR InfClass, DWORD InfStyle,189 PUINT ErrorLine)190 {191 FIXME("not implemented (setupapi.dll) \n");192 return 0;193 }194 195 /***********************************************************************196 * SetupQueueCopyA197 */198 BOOL WINAPI SetupQueueCopyA (HSPFILEQ QueueHandle, PCSTR SourceRootPath, PCSTR SourcePath,199 PCSTR SourceFileName, PCSTR SourceDescription, PCSTR SourceTagFile,200 PCSTR TargetDirectory, PCSTR TargetFileName, DWORD CopyStyle)201 {202 FIXME("not implemented (setupapi.dll) \n");203 return FALSE;204 }205 206 /***********************************************************************207 * SetupSetDirectoryIdA208 */209 BOOL WINAPI SetupSetDirectoryIdA (HINF InfHandle,210 DWORD Id,211 PCSTR Directory)212 {213 FIXME("not implemented (setupapi.dll) \n");214 return FALSE;215 }216 217 218 /***********************************************************************219 * SetupTermDefaultQueueCallback220 */221 VOID WINAPI SetupTermDefaultQueueCallback (PVOID Callback)222 {223 FIXME("not implemented (setupapi.dll) \n");224 }225
Note:
See TracChangeset
for help on using the changeset viewer.