diff --git a/reactos/lib/setupapi/En.rc b/reactos/lib/setupapi/En.rc new file mode 100644 index 00000000000..088f6aaa035 --- /dev/null +++ b/reactos/lib/setupapi/En.rc @@ -0,0 +1,34 @@ +/* + * English resources for SETUPAPI + * + * Copyright 2001 Andreas Mohr + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +COPYFILEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 +STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Copying Files..." +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancel", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Source:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Destination:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END diff --git a/reactos/lib/setupapi/Es.rc b/reactos/lib/setupapi/Es.rc new file mode 100644 index 00000000000..efa01ea412c --- /dev/null +++ b/reactos/lib/setupapi/Es.rc @@ -0,0 +1,34 @@ +/* + * Spanish resources for SETUPAPI + * + * Copyright 2003 José Manuel Ferrer Ortiz + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_SPANISH, SUBLANG_DEFAULT + +COPYFILEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 +STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Copiando archivos..." +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancelar", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Origen:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Destino:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END diff --git a/reactos/lib/setupapi/Fr.rc b/reactos/lib/setupapi/Fr.rc new file mode 100644 index 00000000000..1821aac661b --- /dev/null +++ b/reactos/lib/setupapi/Fr.rc @@ -0,0 +1,35 @@ +/* + * French resources for SETUPAPI + * + * Copyright 2001 Andreas Mohr + * Copyright 2003 Vincent Béron + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL + +COPYFILEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 +STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Copie de fichiers..." +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Annuler", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Source:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Destination:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END diff --git a/reactos/lib/setupapi/It.rc b/reactos/lib/setupapi/It.rc new file mode 100644 index 00000000000..816aa47067c --- /dev/null +++ b/reactos/lib/setupapi/It.rc @@ -0,0 +1,35 @@ +/* + * Italian resources for SETUPAPI + * + * Copyright 2001 Andreas Mohr + * Copyright 2003 Ivan Leo Murray-Smith + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_ITALIAN, SUBLANG_DEFAULT + +COPYFILEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 +STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Copia dei file in corso..." +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Anulla", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Origine:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Destinazione:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END diff --git a/reactos/lib/setupapi/Makefile.in b/reactos/lib/setupapi/Makefile.in index a908ec6b07a..df4fea256e5 100644 --- a/reactos/lib/setupapi/Makefile.in +++ b/reactos/lib/setupapi/Makefile.in @@ -13,11 +13,11 @@ SPEC_SRCS16 = $(ALTNAMES:.dll=.spec) C_SRCS = \ devinst.c \ dirid.c \ + diskspace.c \ install.c \ parser.c \ queue.c \ setupcab.c \ - setupapi_main.c \ stubs.c C_SRCS16 = \ diff --git a/reactos/lib/setupapi/Nl.rc b/reactos/lib/setupapi/Nl.rc new file mode 100644 index 00000000000..a60d3528bfa --- /dev/null +++ b/reactos/lib/setupapi/Nl.rc @@ -0,0 +1,34 @@ +/* + * setupapi (Dutch resources) + * + * Copyright 2003 Hans Leidekker + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_DUTCH, SUBLANG_DEFAULT + +COPYFILEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 +STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Bestanden worden gekopiëerd..." +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Annuleren", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Bron:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Bestemming:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END diff --git a/reactos/lib/setupapi/Pt.rc b/reactos/lib/setupapi/Pt.rc new file mode 100644 index 00000000000..ab1f3b78988 --- /dev/null +++ b/reactos/lib/setupapi/Pt.rc @@ -0,0 +1,34 @@ +/* + * Portuguese resources for SETUPAPI + * + * Copyright 2003 Marcelo Duarte + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_PORTUGUESE, SUBLANG_DEFAULT + +COPYFILEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 +STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Copiando arquivos..." +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Cancelar", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Origem:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Destino:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END diff --git a/reactos/lib/setupapi/Ru.rc b/reactos/lib/setupapi/Ru.rc new file mode 100644 index 00000000000..dc8523a8c4c --- /dev/null +++ b/reactos/lib/setupapi/Ru.rc @@ -0,0 +1,34 @@ +/* + * SETUPAPI (Russian resources) + * + * Copyright 2003 Igor Stepin + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT + +COPYFILEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 +STYLE DS_MODALFRAME | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Êîïèðîâàíèå ôàéëîâ..." +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Îòìåíà", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Îòêóäà:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Êóäà:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END diff --git a/reactos/lib/setupapi/devinst16.c b/reactos/lib/setupapi/devinst16.c index 0c402621410..54e5e10c5b1 100644 --- a/reactos/lib/setupapi/devinst16.c +++ b/reactos/lib/setupapi/devinst16.c @@ -55,6 +55,16 @@ RETERR16 WINAPI DiBuildCompatDrvList16(LPDEVICE_INFO16 lpdi) return FALSE; } +/*********************************************************************** + * DiBuildClassDrvList (SETUPX.301) + */ +RETERR16 WINAPI DiBuildClassDrvList16(LPDEVICE_INFO16 lpdi) +{ + FIXME("(%p): stub\n", lpdi); + lpdi->lpCompatDrvList = NULL; + return FALSE; +} + /*********************************************************************** * DiCallClassInstaller (SETUPX.308) */ diff --git a/reactos/lib/setupapi/dirid.c b/reactos/lib/setupapi/dirid.c index 98fd99e0a32..63f2e86377b 100644 --- a/reactos/lib/setupapi/dirid.c +++ b/reactos/lib/setupapi/dirid.c @@ -18,9 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" diff --git a/reactos/lib/setupapi/diskspace.c b/reactos/lib/setupapi/diskspace.c new file mode 100644 index 00000000000..c851d61c93c --- /dev/null +++ b/reactos/lib/setupapi/diskspace.c @@ -0,0 +1,156 @@ +/* + * SetupAPI DiskSpace functions + * + * Copyright 2004 CodeWeavers (Aric Stewart) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/port.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "winreg.h" +#include "setupapi.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(setupapi); + +typedef struct { + WCHAR lpzName[20]; + LONGLONG dwFreeSpace; + LONGLONG dwWantedSpace; +} DRIVE_ENTRY, *LPDRIVE_ENTRY; + +typedef struct { + DWORD dwDriveCount; + DRIVE_ENTRY Drives[26]; +} DISKSPACELIST, *LPDISKSPACELIST; + + +/*********************************************************************** + * SetupCreateDiskSpaceListW (SETUPAPI.@) + */ +HDSKSPC WINAPI SetupCreateDiskSpaceListW(PVOID Reserved1, DWORD Reserved2, UINT Flags) +{ + WCHAR drives[255]; + DWORD rc; + WCHAR *ptr; + LPDISKSPACELIST list=NULL; + + rc = GetLogicalDriveStringsW(255,drives); + + if (rc == 0) + return NULL; + + list = (LPDISKSPACELIST)HeapAlloc(GetProcessHeap(),0,sizeof(DISKSPACELIST)); + + list->dwDriveCount = 0; + + ptr = drives; + + while (*ptr) + { + DWORD type = GetDriveTypeW(ptr); + DWORD len; + if (type == DRIVE_FIXED) + { + DWORD clusters; + DWORD sectors; + DWORD bytes; + DWORD total; + lstrcpyW(list->Drives[list->dwDriveCount].lpzName,ptr); + GetDiskFreeSpaceW(ptr,§ors,&bytes,&clusters,&total); + list->Drives[list->dwDriveCount].dwFreeSpace = clusters * sectors * + bytes; + list->Drives[list->dwDriveCount].dwWantedSpace = 0; + list->dwDriveCount++; + } + len = lstrlenW(ptr); + len++; + ptr+=sizeof(WCHAR)*len; + } + return (HANDLE)list; +} + + +/*********************************************************************** + * SetupCreateDiskSpaceListA (SETUPAPI.@) + */ +HDSKSPC WINAPI SetupCreateDiskSpaceListA(PVOID Reserved1, DWORD Reserved2, UINT Flags) +{ + return SetupCreateDiskSpaceListW( Reserved1, Reserved2, Flags ); +} + + +/*********************************************************************** + * SetupAddInstallSectionToDiskSpaceListA (SETUPAPI.@) + */ +BOOL WINAPI SetupAddInstallSectionToDiskSpaceListA(HDSKSPC DiskSpace, + HINF InfHandle, HINF LayoutInfHandle, + LPSTR SectionName, PVOID Reserved1, UINT Reserved2) +{ + FIXME ("Stub\n"); + return TRUE; +} + +/*********************************************************************** +* SetupQuerySpaceRequiredOnDriveA (SETUPAPI.@) +*/ +BOOL WINAPI SetupQuerySpaceRequiredOnDriveA(HDSKSPC DiskSpace, + LPSTR DriveSpec, LONGLONG* SpaceRequired, + PVOID Reserved1, UINT Reserved2) +{ + WCHAR driveW[20]; + int i; + LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace; + BOOL rc = FALSE; + WCHAR bkslsh[]= {'\\',0}; + + MultiByteToWideChar(CP_ACP,0,DriveSpec,-1,driveW,20); + + lstrcatW(driveW,bkslsh); + + TRACE("Looking for drive %s\n",debugstr_w(driveW)); + + for (i = 0; i < list->dwDriveCount; i++) + { + TRACE("checking drive %s\n",debugstr_w(list->Drives[i].lpzName)); + if (lstrcmpW(driveW,list->Drives[i].lpzName)==0) + { + rc = TRUE; + *SpaceRequired = list->Drives[i].dwWantedSpace; + break; + } + } + + return rc; +} + +/*********************************************************************** +* SetupDestroyDiskSpaceList (SETUPAPI.@) +*/ +BOOL WINAPI SetupDestroyDiskSpaceList(HDSKSPC DiskSpace) +{ + LPDISKSPACELIST list = (LPDISKSPACELIST)DiskSpace; + HeapFree(GetProcessHeap(),0,list); + return TRUE; +} diff --git a/reactos/lib/setupapi/install.c b/reactos/lib/setupapi/install.c index abf7645666f..eeedd91d77f 100644 --- a/reactos/lib/setupapi/install.c +++ b/reactos/lib/setupapi/install.c @@ -18,9 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" @@ -54,6 +51,14 @@ struct registry_callback_info BOOL delete; }; +/* info passed to callback functions dealing with registering dlls */ +struct register_dll_info +{ + PSP_FILE_CALLBACK_W callback; + PVOID callback_context; + BOOL unregister; +}; + typedef BOOL (*iterate_fields_func)( HINF hinf, PCWSTR field, void *arg ); /* Unicode constants */ @@ -64,8 +69,13 @@ static const WCHAR Ini2Reg[] = {'I','n','i','2','R','e','g',0}; static const WCHAR LogConf[] = {'L','o','g','C','o','n','f',0}; static const WCHAR AddReg[] = {'A','d','d','R','e','g',0}; static const WCHAR DelReg[] = {'D','e','l','R','e','g',0}; +static const WCHAR BitReg[] = {'B','i','t','R','e','g',0}; static const WCHAR UpdateInis[] = {'U','p','d','a','t','e','I','n','i','s',0}; +static const WCHAR CopyINF[] = {'C','o','p','y','I','N','F',0}; static const WCHAR UpdateIniFields[] = {'U','p','d','a','t','e','I','n','i','F','i','e','l','d','s',0}; +static const WCHAR RegisterDlls[] = {'R','e','g','i','s','t','e','r','D','l','l','s',0}; +static const WCHAR UnregisterDlls[] = {'U','n','r','e','g','i','s','t','e','r','D','l','l','s',0}; +static const WCHAR ProfileItems[] = {'P','r','o','f','i','l','e','I','t','e','m','s',0}; /*********************************************************************** @@ -423,6 +433,158 @@ static BOOL registry_callback( HINF hinf, PCWSTR field, void *arg ) } +/*********************************************************************** + * do_register_dll + * + * Register or unregister a dll. + */ +static BOOL do_register_dll( const struct register_dll_info *info, const WCHAR *path, + INT flags, INT timeout, const WCHAR *args ) +{ + HMODULE module; + HRESULT res; + SP_REGISTER_CONTROL_STATUSW status; + + status.cbSize = sizeof(status); + status.FileName = path; + status.FailureCode = SPREG_SUCCESS; + status.Win32Error = ERROR_SUCCESS; + + if (info->callback) + { + switch(info->callback( info->callback_context, SPFILENOTIFY_STARTREGISTRATION, + (UINT_PTR)&status, !info->unregister )) + { + case FILEOP_ABORT: + SetLastError( ERROR_OPERATION_ABORTED ); + return FALSE; + case FILEOP_SKIP: + return TRUE; + case FILEOP_DOIT: + break; + } + } + + if (!(module = LoadLibraryExW( path, 0, LOAD_WITH_ALTERED_SEARCH_PATH ))) + { + WARN( "could not load %s\n", debugstr_w(path) ); + status.FailureCode = SPREG_LOADLIBRARY; + status.Win32Error = GetLastError(); + goto done; + } + + if (flags & FLG_REGSVR_DLLREGISTER) + { + const char *entry_point = info->unregister ? "DllUnregisterServer" : "DllRegisterServer"; + HRESULT (WINAPI *func)(void) = (void *)GetProcAddress( module, entry_point ); + + if (!func) + { + status.FailureCode = SPREG_GETPROCADDR; + status.Win32Error = GetLastError(); + goto done; + } + + TRACE( "calling %s in %s\n", entry_point, debugstr_w(path) ); + res = func(); + + if (FAILED(res)) + { + WARN( "calling %s in %s returned error %lx\n", entry_point, debugstr_w(path), res ); + status.FailureCode = SPREG_REGSVR; + status.Win32Error = res; + goto done; + } + } + + if (flags & FLG_REGSVR_DLLINSTALL) + { + HRESULT (WINAPI *func)(BOOL,LPCWSTR) = (void *)GetProcAddress( module, "DllInstall" ); + + if (!func) + { + status.FailureCode = SPREG_GETPROCADDR; + status.Win32Error = GetLastError(); + goto done; + } + + TRACE( "calling DllInstall(%d,%s) in %s\n", + !info->unregister, debugstr_w(args), debugstr_w(path) ); + res = func( !info->unregister, args ); + + if (FAILED(res)) + { + WARN( "calling DllInstall in %s returned error %lx\n", debugstr_w(path), res ); + status.FailureCode = SPREG_REGSVR; + status.Win32Error = res; + goto done; + } + } + +done: + if (module) FreeLibrary( module ); + if (info->callback) info->callback( info->callback_context, SPFILENOTIFY_ENDREGISTRATION, + (UINT_PTR)&status, !info->unregister ); + return TRUE; +} + + +/*********************************************************************** + * register_dlls_callback + * + * Called once for each RegisterDlls entry in a given section. + */ +static BOOL register_dlls_callback( HINF hinf, PCWSTR field, void *arg ) +{ + struct register_dll_info *info = arg; + INFCONTEXT context; + BOOL ret = TRUE; + BOOL ok = SetupFindFirstLineW( hinf, field, NULL, &context ); + + for (; ok; ok = SetupFindNextLine( &context, &context )) + { + WCHAR *path, *args, *p; + WCHAR buffer[MAX_INF_STRING_LENGTH]; + INT flags, timeout; + + /* get directory */ + if (!(path = PARSER_get_dest_dir( &context ))) continue; + + /* get dll name */ + if (!SetupGetStringFieldW( &context, 3, buffer, sizeof(buffer)/sizeof(WCHAR), NULL )) + goto done; + if (!(p = HeapReAlloc( GetProcessHeap(), 0, path, + (strlenW(path) + strlenW(buffer) + 2) * sizeof(WCHAR) ))) goto done; + path = p; + p += strlenW(p); + if (p == path || p[-1] != '\\') *p++ = '\\'; + strcpyW( p, buffer ); + + /* get flags */ + if (!SetupGetIntField( &context, 4, &flags )) flags = 0; + + /* get timeout */ + if (!SetupGetIntField( &context, 5, &timeout )) timeout = 60; + + /* get command line */ + args = NULL; + if (SetupGetStringFieldW( &context, 6, buffer, sizeof(buffer)/sizeof(WCHAR), NULL )) + args = buffer; + + ret = do_register_dll( info, path, flags, timeout, args ); + + done: + HeapFree( GetProcessHeap(), 0, path ); + if (!ret) break; + } + return ret; +} + +/*********************************************************************** + * update_ini_callback + * + * Called once for each UpdateInis entry in a given section. + */ static BOOL update_ini_callback( HINF hinf, PCWSTR field, void *arg ) { INFCONTEXT context; @@ -490,6 +652,24 @@ static BOOL logconf_callback( HINF hinf, PCWSTR field, void *arg ) return TRUE; } +static BOOL bitreg_callback( HINF hinf, PCWSTR field, void *arg ) +{ + FIXME( "should do bitreg %s\n", debugstr_w(field) ); + return TRUE; +} + +static BOOL profile_items_callback( HINF hinf, PCWSTR field, void *arg ) +{ + FIXME( "should do profile items %s\n", debugstr_w(field) ); + return TRUE; +} + +static BOOL copy_inf_callback( HINF hinf, PCWSTR field, void *arg ) +{ + FIXME( "should do copy inf %s\n", debugstr_w(field) ); + return TRUE; +} + /*********************************************************************** * iterate_section_fields @@ -515,7 +695,8 @@ static BOOL iterate_section_fields( HINF hinf, PCWSTR section, PCWSTR key, goto done; if (!callback( hinf, buffer, arg )) { - ERR("callback failed for %s %s\n", debugstr_w(section), debugstr_w(buffer) ); + WARN("callback failed for %s %s err %ld\n", + debugstr_w(section), debugstr_w(buffer), GetLastError() ); goto done; } } @@ -650,13 +831,41 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section, if (!iterate_section_fields( hinf, section, Ini2Reg, ini2reg_callback, NULL )) return FALSE; } - if (flags & SPINST_LOGCONFIG) { if (!iterate_section_fields( hinf, section, LogConf, logconf_callback, NULL )) return FALSE; } + if (flags & SPINST_REGSVR) + { + struct register_dll_info info; + info.unregister = FALSE; + if (flags & SPINST_REGISTERCALLBACKAWARE) + { + info.callback = callback; + info.callback_context = context; + } + else info.callback = NULL; + + if (!iterate_section_fields( hinf, section, RegisterDlls, register_dlls_callback, &info )) + return FALSE; + } + if (flags & SPINST_UNREGSVR) + { + struct register_dll_info info; + + info.unregister = TRUE; + if (flags & SPINST_REGISTERCALLBACKAWARE) + { + info.callback = callback; + info.callback_context = context; + } + else info.callback = NULL; + + if (!iterate_section_fields( hinf, section, UnregisterDlls, register_dlls_callback, &info )) + return FALSE; + } if (flags & SPINST_REGISTRY) { struct registry_callback_info info; @@ -669,7 +878,78 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section, if (!iterate_section_fields( hinf, section, AddReg, registry_callback, &info )) return FALSE; } - if (flags & (SPINST_BITREG|SPINST_REGSVR|SPINST_UNREGSVR|SPINST_PROFILEITEMS|SPINST_COPYINF)) - FIXME( "unsupported flags %x\n", flags ); + if (flags & SPINST_BITREG) + { + if (!iterate_section_fields( hinf, section, BitReg, bitreg_callback, NULL )) + return FALSE; + } + if (flags & SPINST_PROFILEITEMS) + { + if (!iterate_section_fields( hinf, section, ProfileItems, profile_items_callback, NULL )) + return FALSE; + } + if (flags & SPINST_COPYINF) + { + if (!iterate_section_fields( hinf, section, CopyINF, copy_inf_callback, NULL )) + return FALSE; + } + return TRUE; } + + +/*********************************************************************** + * InstallHinfSectionW (SETUPAPI.@) + * + * NOTE: 'cmdline' is
from + * RUNDLL32.EXE SETUPAPI.DLL,InstallHinfSection
+ */ +void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show ) +{ + WCHAR *p, *path, section[MAX_PATH]; + void *callback_context; + UINT mode; + HINF hinf; + + TRACE("hwnd %p, handle %p, cmdline %s\n", hwnd, handle, debugstr_w(cmdline)); + + lstrcpynW( section, cmdline, sizeof(section)/sizeof(WCHAR) ); + + if (!(p = strchrW( section, ' ' ))) return; + *p++ = 0; + while (*p == ' ') p++; + mode = atoiW( p ); + + if (!(p = strchrW( p, ' ' ))) return; + path = p + 1; + while (*path == ' ') path++; + + hinf = SetupOpenInfFileW( path, NULL, INF_STYLE_WIN4, NULL ); + if (hinf == INVALID_HANDLE_VALUE) return; + + callback_context = SetupInitDefaultQueueCallback( hwnd ); + SetupInstallFromInfSectionW( hwnd, hinf, section, SPINST_ALL, NULL, NULL, SP_COPY_NEWER, + SetupDefaultQueueCallbackW, callback_context, + NULL, NULL ); + SetupTermDefaultQueueCallback( callback_context ); + SetupCloseInfFile( hinf ); + + /* FIXME: should check the mode and maybe reboot */ + /* there isn't much point in doing that since we */ + /* don't yet handle deferred file copies anyway. */ +} + + +/*********************************************************************** + * InstallHinfSectionA (SETUPAPI.@) + */ +void WINAPI InstallHinfSectionA( HWND hwnd, HINSTANCE handle, LPCSTR cmdline, INT show ) +{ + UNICODE_STRING cmdlineW; + + if (RtlCreateUnicodeStringFromAsciiz( &cmdlineW, cmdline )) + { + InstallHinfSectionW( hwnd, handle, cmdlineW.Buffer, show ); + RtlFreeUnicodeString( &cmdlineW ); + } +} diff --git a/reactos/lib/setupapi/parser.c b/reactos/lib/setupapi/parser.c index 9d3f2c08cbc..8c760f01b75 100644 --- a/reactos/lib/setupapi/parser.c +++ b/reactos/lib/setupapi/parser.c @@ -36,6 +36,7 @@ #include "winternl.h" #include "winerror.h" #include "setupapi.h" +#include "setupapi_private.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -568,7 +569,7 @@ static void close_current_line( struct parser *parser ) static const WCHAR *line_start_state( struct parser *parser, const WCHAR *pos ) { const WCHAR *p; - + for (p = pos; !is_eof( parser, p ); p++) { switch(*p) @@ -795,7 +796,7 @@ static const WCHAR *quotes_state( struct parser *parser, const WCHAR *pos ) static const WCHAR *leading_spaces_state( struct parser *parser, const WCHAR *pos ) { const WCHAR *p; - + for (p = pos; !is_eol( parser, p ); p++) { if (*p == '\\') @@ -945,7 +946,7 @@ static struct inf_file *parse_file( HANDLE handle, const WCHAR *class, UINT *err file->string_pos = file->strings; file->strings_section = -1; - if (TRUE)//(!RtlIsTextUnicode( buffer, size, NULL )) // Fireball, 07 Feb 04, temp fix + if (!RtlIsTextUnicode( buffer, size, NULL )) { WCHAR *new_buff = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) ); if (new_buff) @@ -999,6 +1000,32 @@ const WCHAR *PARSER_get_src_root( HINF hinf ) } +/*********************************************************************** + * PARSER_get_dest_dir + * + * retrieve a destination dir of the form "dirid,relative_path" in the given entry. + * returned buffer must be freed by caller. + */ +WCHAR *PARSER_get_dest_dir( INFCONTEXT *context ) +{ + const WCHAR *dir; + WCHAR *ptr, *ret; + INT dirid; + DWORD len1, len2; + + if (!SetupGetIntField( context, 1, &dirid )) return NULL; + if (!(dir = DIRID_get_string( context->Inf, dirid ))) return NULL; + len1 = strlenW(dir) + 1; + if (!SetupGetStringFieldW( context, 2, NULL, 0, &len2 )) len2 = 0; + if (!(ret = HeapAlloc( GetProcessHeap(), 0, (len1+len2) * sizeof(WCHAR) ))) return NULL; + strcpyW( ret, dir ); + ptr = ret + strlenW(ret); + if (len2 && ptr > ret && ptr[-1] != '\\') *ptr++ = '\\'; + if (!SetupGetStringFieldW( context, 2, ptr, len2, NULL )) *ptr = 0; + return ret; +} + + /*********************************************************************** * SetupOpenInfFileA (SETUPAPI.@) */ @@ -1067,6 +1094,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err handle = CreateFileW( path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); } } + if (handle != INVALID_HANDLE_VALUE) { file = parse_file( handle, class, error ); diff --git a/reactos/lib/setupapi/queue.c b/reactos/lib/setupapi/queue.c index d7578683ba1..38b11151e07 100644 --- a/reactos/lib/setupapi/queue.c +++ b/reactos/lib/setupapi/queue.c @@ -18,9 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" -#include "wine/port.h" - #include #include "windef.h" @@ -249,6 +246,22 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, MultiByteToWideChar( CP_ACP, 0, buffer, -1, (WCHAR *)old_param2, MAX_PATH ); break; + case SPFILENOTIFY_STARTREGISTRATION: + case SPFILENOTIFY_ENDREGISTRATION: + { + SP_REGISTER_CONTROL_STATUSW *statusW = (SP_REGISTER_CONTROL_STATUSW *)param1; + SP_REGISTER_CONTROL_STATUSA statusA; + + statusA.cbSize = sizeof(statusA); + statusA.FileName = strdupWtoA( statusW->FileName ); + statusA.Win32Error = statusW->Win32Error; + statusA.FailureCode = statusW->FailureCode; + ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification, + (UINT_PTR)&statusA, param2 ); + HeapFree( GetProcessHeap(), 0, (LPSTR)statusA.FileName ); + } + break; + case SPFILENOTIFY_NEEDMEDIA: case SPFILENOTIFY_QUEUESCAN: FIXME("mapping for %d not implemented\n",notification); @@ -260,7 +273,7 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, ret = callback_ctx->orig_handler( callback_ctx->orig_context, notification, param1, param2 ); break; } - return ret; + return ret; } @@ -351,25 +364,11 @@ static WCHAR *get_destination_dir( HINF hinf, const WCHAR *section ) { static const WCHAR Dest[] = {'D','e','s','t','i','n','a','t','i','o','n','D','i','r','s',0}; static const WCHAR Def[] = {'D','e','f','a','u','l','t','D','e','s','t','D','i','r',0}; - - const WCHAR *dir; - WCHAR *ptr, *ret; INFCONTEXT context; - INT dirid; - DWORD len1, len2; if (!SetupFindFirstLineW( hinf, Dest, section, &context ) && !SetupFindFirstLineW( hinf, Dest, Def, &context )) return NULL; - if (!SetupGetIntField( &context, 1, &dirid )) return NULL; - if (!(dir = DIRID_get_string( hinf, dirid ))) return NULL; - len1 = strlenW(dir) + 1; - if (!SetupGetStringFieldW( &context, 2, NULL, 0, &len2 )) len2 = 0; - if (!(ret = HeapAlloc( GetProcessHeap(), 0, (len1+len2) * sizeof(WCHAR) ))) return NULL; - strcpyW( ret, dir ); - ptr = ret + strlenW(ret); - if (len2 && ptr > ret && ptr[-1] != '\\') *ptr++ = '\\'; - if (!SetupGetStringFieldW( &context, 2, ptr, len2, NULL )) *ptr = 0; - return ret; + return PARSER_get_dest_dir( &context ); } diff --git a/reactos/lib/setupapi/setupapi.rc b/reactos/lib/setupapi/setupapi.rc index e218c3c1910..d8edbda926b 100644 --- a/reactos/lib/setupapi/setupapi.rc +++ b/reactos/lib/setupapi/setupapi.rc @@ -1,38 +1,33 @@ -#include -#include +/* + * Top level resource file for SETUPX + * + * Copyright 2001 Andreas Mohr + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US - -VS_VERSION_INFO VERSIONINFO - FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD - PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", RES_STR_COMPANY_NAME - VALUE "FileDescription", "WINE IMM32 API Client DLL\0" - VALUE "FileVersion", RES_STR_FILE_VERSION - VALUE "InternalName", "imm32\0" - VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT - VALUE "OriginalFilename", "imm32.dll\0" - VALUE "ProductName", RES_STR_PRODUCT_NAME - VALUE "ProductVersion", RES_STR_PRODUCT_VERSION - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winnls.h" +#include "setupapi_private.h" +#include "En.rc" +#include "Es.rc" +#include "Fr.rc" +#include "It.rc" +#include "Nl.rc" +#include "Pt.rc" +#include "Ru.rc" diff --git a/reactos/lib/setupapi/setupapi.spec b/reactos/lib/setupapi/setupapi.spec index fbd58dd929d..6f5413d1a30 100644 --- a/reactos/lib/setupapi/setupapi.spec +++ b/reactos/lib/setupapi/setupapi.spec @@ -27,9 +27,9 @@ @ stub GetSetFileTimestamp @ stub GetVersionInfoFromImage @ stub InfIsFromOemLocation -@ stdcall InstallHinfSection(long long str long) -@ stub InstallHinfSectionA -@ stub InstallHinfSectionW +@ stdcall InstallHinfSection(long long str long) InstallHinfSectionA +@ stdcall InstallHinfSectionA(long long str long) +@ stdcall InstallHinfSectionW(long long wstr long) @ stub InstallStop @ stub IsUserAdmin @ stub LookUpStringInTable @@ -50,7 +50,7 @@ @ stub RetrieveServiceConfig @ stub SearchForInfFile @ stub SetArrayToMultiSzValue -@ stub SetupAddInstallSectionToDiskSpaceListA +@ stdcall SetupAddInstallSectionToDiskSpaceListA(long long long str ptr long) @ stub SetupAddInstallSectionToDiskSpaceListW @ stub SetupAddSectionToDiskSpaceListA @ stub SetupAddSectionToDiskSpaceListW @@ -70,8 +70,8 @@ @ stub SetupCopyErrorW @ stdcall SetupCopyOEMInfA(str str long long ptr long ptr ptr) @ stub SetupCopyOEMInfW -@ stub SetupCreateDiskSpaceListA -@ stub SetupCreateDiskSpaceListW +@ stdcall SetupCreateDiskSpaceListA(ptr long long) +@ stdcall SetupCreateDiskSpaceListW(ptr long long) @ stub SetupDecompressOrCopyFileA @ stub SetupDecompressOrCopyFileW @ stub SetupDefaultQueueCallback @@ -79,7 +79,7 @@ @ stdcall SetupDefaultQueueCallbackW(ptr long long long) @ stub SetupDeleteErrorA @ stub SetupDeleteErrorW -@ stub SetupDestroyDiskSpaceList +@ stdcall SetupDestroyDiskSpaceList(long) @ stub SetupDiAskForOEMDisk @ stub SetupDiBuildClassInfoList @ stdcall SetupDiBuildClassInfoListExW(long ptr long ptr wstr ptr) @@ -195,7 +195,7 @@ @ stdcall SetupGetFileQueueFlags(long ptr) @ stub SetupGetInfFileListA @ stub SetupGetInfFileListW -@ stub SetupGetInfInformationA +@ stdcall SetupGetInfInformationA(ptr long ptr long ptr) @ stub SetupGetInfInformationW @ stdcall SetupGetIntField(ptr long ptr) @ stdcall SetupGetLineByIndexA(long str long ptr) @@ -218,8 +218,8 @@ @ stub SetupGetTargetPathW @ stdcall SetupInitDefaultQueueCallback(long) @ stdcall SetupInitDefaultQueueCallbackEx(long long long long ptr) -@ stub SetupInitializeFileLogA -@ stub SetupInitializeFileLogW +@ stdcall SetupInitializeFileLogA (str long) +@ stdcall SetupInitializeFileLogW (wstr long) @ stub SetupInstallFileA @ stub SetupInstallFileExA @ stub SetupInstallFileExW @@ -254,7 +254,7 @@ @ stub SetupQueryInfOriginalFileInformationW @ stub SetupQuerySourceListA @ stub SetupQuerySourceListW -@ stub SetupQuerySpaceRequiredOnDriveA +@ stdcall SetupQuerySpaceRequiredOnDriveA(long str ptr ptr long) @ stub SetupQuerySpaceRequiredOnDriveW @ stdcall SetupQueueCopyA(long str str str str str str str long) @ stdcall SetupQueueCopyIndirectA(ptr) @@ -297,7 +297,7 @@ @ stub SetupSetSourceListA @ stub SetupSetSourceListW @ stdcall SetupTermDefaultQueueCallback(ptr) -@ stub SetupTerminateFileLog +@ stdcall SetupTerminateFileLog(long) @ stub ShouldDeviceBeExcluded @ stub StampFileSecurity @ stub StringTableAddString diff --git a/reactos/lib/setupapi/setupapi_main.c b/reactos/lib/setupapi/setupapi_main.c deleted file mode 100644 index 441c5b8fbe6..00000000000 --- a/reactos/lib/setupapi/setupapi_main.c +++ /dev/null @@ -1,392 +0,0 @@ -/* - * SETUPAPI library functions - * 32-bit version of setupx_main.c - * - * Copyright 2004 Aleksey Bragin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include -#include -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "winerror.h" -#include "wine/winuser16.h" -#include "wownt32.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "setupapi.h" -#include "setupx16.h" -#include "setupapi_private.h" -#include "winerror.h" -#include "wine/debug.h" - -//WINE_DEFAULT_DEBUG_CHANNEL(setupapi); - -/* - * Returns pointer to a string list with the first entry being number - * of strings. - * - * Hmm. Should this be InitSubstrData(), GetFirstSubstr() and GetNextSubstr() - * instead? - */ -static LPSTR *SETUPX_GetSubStrings(LPSTR start, char delimiter) -{ - LPSTR p, q; - LPSTR *res = NULL; - DWORD count = 0; - int len; - - p = start; - - while (1) - { - /* find beginning of real substring */ - while ( (*p == ' ') || (*p == '\t') || (*p == '"') ) p++; - - /* find end of real substring */ - q = p; - while ( (*q) - && (*q != ' ') && (*q != '\t') && (*q != '"') - && (*q != ';') && (*q != delimiter) ) q++; - if (q == p) - break; - len = (int)q - (int)p; - - /* alloc entry for new substring in steps of 32 units and copy over */ - if (count % 32 == 0) - { /* 1 for count field + current count + 32 */ - if (res) - res = HeapReAlloc(GetProcessHeap(), 0, res, (1+count+32)*sizeof(LPSTR)); - else - res = HeapAlloc(GetProcessHeap(), 0, (1+count+32)*sizeof(LPSTR)); - } - *(res+1+count) = HeapAlloc(GetProcessHeap(), 0, len+1); - strncpy(*(res+1+count), p, len); - (*(res+1+count))[len] = '\0'; - count++; - - /* we are still within last substring (before delimiter), - * so get out of it */ - while ((*q) && (*q != ';') && (*q != delimiter)) q++; - if ((!*q) || (*q == ';')) - break; - p = q+1; - } - - /* put number of entries at beginning of list */ - *(DWORD *)res = count; - return res; -} - -static void SETUPX_FreeSubStrings(LPSTR *substr) -{ - DWORD count = *(DWORD *)substr; - LPSTR *pStrings = substr+1; - DWORD n; - - for (n=0; n < count; n++) - HeapFree(GetProcessHeap(), 0, *pStrings++); - - HeapFree(GetProcessHeap(), 0, substr); -} - -// Temp for debugging -#ifdef FIREBALL_DOING_DEBUG -int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, - LPSTR lpszCmdLine, int nCmdShow ) -{ - void WINAPI InstallHinfSection(HWND hwnd, HINSTANCE handle, LPCSTR lpszCmdLine, INT nCmdShow); - - InstallHinfSection(NULL, hInstance, lpszCmdLine, nCmdShow); - return 0; -} -#endif - - -/*********************************************************************** - * InstallHinfSection (SETUPAPI.@) - * - * hwnd = parent window - * handle = instance of SETUPAPI.DLL - * lpszCmdLine = e.g. "DefaultInstall 132 C:\MYINSTALL\MYDEV.INF" - * Here "DefaultInstall" is the .inf file section to be installed (optional). - * The 132 value is made of the HOW_xxx flags and sometimes 128 (-> setupx16.h). - * - * nCmdShow = nCmdShow of CreateProcess - */ - -// In development now, current status: -// Currently it does registry settings + file operations -// Registry settings tested -// File operations - not tested, just done according to MSDN (file queus) -// Flags - taken from WINE implementation - -void WINAPI InstallHinfSection(HWND hwnd, HINSTANCE handle, LPCSTR lpszCmdLine, INT nCmdShow) -{ - LPSTR *pSub; - DWORD count; - HINF hInf = 0; - WORD wFlags; - BOOL reboot = FALSE; - BOOL err; - HSPFILEQ fQueue; - PVOID cbContext; - - TRACE("(%04x, %04x, %s, %d);\n", hwnd, hinst, lpszCmdLine, nCmdShow); - - pSub = SETUPX_GetSubStrings((LPSTR)lpszCmdLine, ' '); - count = *(DWORD *)pSub; - - if (count < 2) /* invalid number of arguments ? */ - { - SETUPX_FreeSubStrings(pSub); - return; - } - - hInf = SetupOpenInfFileA(*(pSub+count), NULL, INF_STYLE_WIN4, NULL); - if (hInf == (HINF)INVALID_HANDLE_VALUE) - { - SetLastError(ERROR_FILE_NOT_FOUND); - SETUPX_FreeSubStrings(pSub); - return; - } - - // Deal with registry settings - err = SetupInstallFromInfSectionA(hwnd, hInf, (PCSTR)(*(pSub+1)), SPINST_ALL ^ SPINST_FILES/*flags*/, - NULL/*HKEY key_root*/, NULL/*PCWSTR src_root*/, 0/*UINT copy_flags*/, - NULL/*PSP_FILE_CALLBACK_W callback*/, NULL/*PVOID context*/, - NULL/*HDEVINFO devinfo*/, NULL/*PSP_DEVINFO_DATA devinfo_data*/); - - if (err) - { - // TODO: Show some message box saying installing from INF section has failed - // FIXME: Use strings from resources, and do it the way Windows does - MessageBox(hwnd, "InstallFromHinfSection", "Installing registry settings from an INF section failed", MB_OK); - - // release alloced memory - SetupCloseInfFile(hInf); - SETUPX_FreeSubStrings(pSub); - return; - } - - // Deal with files now - fQueue = SetupOpenFileQueue(); - - if (fQueue == INVALID_HANDLE_VALUE) - { - // TODO: Show some message box saying creating a file queue has failed - MessageBox(hwnd, "InstallFromHinfSection", "File queue opening failed", MB_OK); - - // release alloced memory - SetupCloseInfFile(hInf); - SETUPX_FreeSubStrings(pSub); - return; - } - - cbContext = SetupInitDefaultQueueCallback(hwnd); - - // Fullfill the file queue - //FIXME: Is the flag (SP_COPY_NEWER) right for this call? - SetupInstallFilesFromInfSectionA(hInf, /*HINF hlayout*/NULL, fQueue, - (PCSTR)(*(pSub+1)), /*PCSTR src_root*/NULL, SP_COPY_NEWER); - - err = SetupCommitFileQueueA(hwnd, fQueue, SetupDefaultQueueCallbackA, cbContext); - - - // Release all alloced handles and memory - SetupCloseFileQueue(fQueue); - SetupTermDefaultQueueCallback(cbContext); - SetupCloseInfFile(hInf); - SETUPX_FreeSubStrings(pSub); - - // Deal with flags now - wFlags = atoi(*(pSub+count-1)) & ~128; - switch (wFlags) - { - case HOW_ALWAYS_SILENT_REBOOT: - case HOW_SILENT_REBOOT: - reboot = TRUE; - break; - case HOW_ALWAYS_PROMPT_REBOOT: - case HOW_PROMPT_REBOOT: - // FIXME: What is the SetupPromptReboot() function is for? - // Anyway it isn't implemented - if (MessageBoxA(hwnd, "You must restart ReactOS before the new settings will take effect.\n\nDo you want to exit ReactOS now ?", "Systems Settings Change", MB_YESNO|MB_ICONQUESTION) == IDYES) - reboot = TRUE; - break; - default: - ERR("invalid flags %d !\n", wFlags); - return; - } - - if (reboot) - { - ExitWindowsEx(EWX_REBOOT, 0); - } -} - -typedef struct -{ - LPCSTR RegValName; - LPCSTR StdString; /* fallback string; sub dir of windows directory */ -} LDID_DATA; - -static const LDID_DATA LDID_Data[34] = -{ - { /* 0 (LDID_NULL) -- not defined */ - NULL, - NULL - }, - { /* 1 (LDID_SRCPATH) = source of installation. hmm, what to do here ? */ - "SourcePath", /* hmm, does SETUPX have to care about updating it ?? */ - NULL - }, - { /* 2 (LDID_SETUPTEMP) = setup temp dir */ - "SetupTempDir", - NULL - }, - { /* 3 (LDID_UNINSTALL) = uninstall backup dir */ - "UninstallDir", - NULL - }, - { /* 4 (LDID_BACKUP) = backup dir */ - "BackupDir", - NULL - }, - { /* 5 (LDID_SETUPSCRATCH) = setup scratch dir */ - "SetupScratchDir", - NULL - }, - { /* 6 -- not defined */ - NULL, - NULL - }, - { /* 7 -- not defined */ - NULL, - NULL - }, - { /* 8 -- not defined */ - NULL, - NULL - }, - { /* 9 -- not defined */ - NULL, - NULL - }, - { /* 10 (LDID_WIN) = windows dir */ - "WinDir", - "" - }, - { /* 11 (LDID_SYS) = system dir */ - "SysDir", - NULL /* call GetSystemDirectory() instead */ - }, - { /* 12 (LDID_IOS) = IOSubSys dir */ - NULL, /* FIXME: registry string ? */ - "SYSTEM\\IOSUBSYS" - }, - { /* 13 (LDID_CMD) = COMMAND dir */ - NULL, /* FIXME: registry string ? */ - "COMMAND" - }, - { /* 14 (LDID_CPL) = control panel dir */ - NULL, - "" - }, - { /* 15 (LDID_PRINT) = windows printer dir */ - NULL, - "SYSTEM" /* correct ?? */ - }, - { /* 16 (LDID_MAIL) = destination mail dir */ - NULL, - "" - }, - { /* 17 (LDID_INF) = INF dir */ - "SetupScratchDir", /* correct ? */ - "INF" - }, - { /* 18 (LDID_HELP) = HELP dir */ - NULL, /* ??? */ - "HELP" - }, - { /* 19 (LDID_WINADMIN) = Admin dir */ - "WinAdminDir", - "" - }, - { /* 20 (LDID_FONTS) = Fonts dir */ - NULL, /* ??? */ - "FONTS" - }, - { /* 21 (LDID_VIEWERS) = Viewers */ - NULL, /* ??? */ - "SYSTEM\\VIEWERS" - }, - { /* 22 (LDID_VMM32) = VMM32 dir */ - NULL, /* ??? */ - "SYSTEM\\VMM32" - }, - { /* 23 (LDID_COLOR) = ICM dir */ - "ICMPath", - "SYSTEM\\COLOR" - }, - { /* 24 (LDID_APPS) = root of boot drive ? */ - "AppsDir", - "C:\\" - }, - { /* 25 (LDID_SHARED) = shared dir */ - "SharedDir", - "" - }, - { /* 26 (LDID_WINBOOT) = Windows boot dir */ - "WinBootDir", - "" - }, - { /* 27 (LDID_MACHINE) = machine specific files */ - "MachineDir", - NULL - }, - { /* 28 (LDID_HOST_WINBOOT) = Host Windows boot dir */ - "HostWinBootDir", - NULL - }, - { /* 29 -- not defined */ - NULL, - NULL - }, - { /* 30 (LDID_BOOT) = Root of boot drive */ - "BootDir", - NULL - }, - { /* 31 (LDID_BOOT_HOST) = Root of boot drive host */ - "BootHost", - NULL - }, - { /* 32 (LDID_OLD_WINBOOT) = subdir of root */ - "OldWinBootDir", - NULL - }, - { /* 33 (LDID_OLD_WIN) = old win dir */ - "OldWinDir", - NULL - } - /* the rest (34-38) isn't too interesting, so I'll forget about it */ -}; diff --git a/reactos/lib/setupapi/setupapi_private.h b/reactos/lib/setupapi/setupapi_private.h index 443c3e4e73a..7cd40e4f146 100644 --- a/reactos/lib/setupapi/setupapi_private.h +++ b/reactos/lib/setupapi/setupapi_private.h @@ -38,6 +38,7 @@ extern unsigned int PARSER_string_substA( struct inf_file *file, const WCHAR *te extern unsigned int PARSER_string_substW( struct inf_file *file, const WCHAR *text, WCHAR *buffer, unsigned int size ); extern const WCHAR *PARSER_get_src_root( HINF hinf ); +extern WCHAR *PARSER_get_dest_dir( INFCONTEXT *context ); /* support for Ascii queue callback functions */ diff --git a/reactos/lib/setupapi/setupx.spec b/reactos/lib/setupapi/setupx.spec new file mode 100644 index 00000000000..be6bcfd640f --- /dev/null +++ b/reactos/lib/setupapi/setupx.spec @@ -0,0 +1,269 @@ +1 stub WEP +2 pascal -ret16 IpOpen(str ptr) IpOpen16 +3 stub IpOpenAppend #(str word) +4 pascal -ret16 IpClose(word) IpClose16 +5 stub IpGetLongField #(word ptr word ptr) +6 stub IpGetStringField #(word ptr word ptr word ptr) +7 stub IpFindFirstLine #(word str str ptr) +8 stub IpGetLineCount #(word str ptr) +9 stub IpGetFieldCount #(word ptr ptr) +10 stub IpGetIntField #(word ptr word ptr) +11 stub IpFindNextLine #(word ptr) +12 stub IpGetFileName #(word ptr word) +13 pascal -ret16 VcpQueueCopy(str str str str word word ptr word long) VcpQueueCopy16 +14 stub NOAUTORUNWNDPROC +15 stub __DEBUGMSG +16 stub __ASSERTMSG +17 pascal -ret16 VcpQueueDelete(str str word long) VcpQueueDelete16 +18 stub TpOpenFile #(str ptr word) +19 stub TpCloseFile #(word) +20 stub TpOpenSection #(word ptr str word) +21 stub TpCloseSection #(word) +22 stub TpCommitSection #(word word str word) +23 stub TpGetLine #(word str str word word ptr) +24 stub TpGetNextLine #(word str str ptr) +25 stub TpInsertLine #(word str str word word word) +26 stub TpReplaceLine #(word str str word word word) +27 stub TpDeleteLine #(word word word word) +28 stub TpMoveLine #(word word word word word word) +29 stub TpGetLineContents #(word ptr word ptr word word word) +30 stub TpGetPrivateProfileString #(str str str ptr word str) +31 stub TpWritePrivateProfileString #(str str str str) +32 stub TpGetProfileString #(str str str ptr word) +33 pascal -ret16 CtlSetLdd(ptr) CtlSetLdd16 +34 pascal -ret16 CtlGetLdd(ptr) CtlGetLdd16 +35 pascal -ret16 CtlFindLdd(ptr) CtlFindLdd16 +36 pascal -ret16 CtlAddLdd(ptr) CtlAddLdd16 +37 pascal -ret16 CtlDelLdd(word) CtlDelLdd16 +38 pascal -ret16 CtlGetLddPath(word ptr) CtlGetLddPath16 +39 stub SURegCloseKey #(word) +40 stub SURegCreateKey #(word) +41 stub SURegDeleteKey #(word str) +42 stub SURegDeleteValue #(word str) +43 stub SURegEnumKey #(word long ptr long) +44 stub SURegEnumValue #(word long str ptr ptr ptr ptr ptr) +45 stub SURegFlush #() +46 stub SURegInit #() +47 pascal SURegOpenKey(word str ptr) SURegOpenKey +48 stub SURegQueryValue +49 stub SURegQueryValue16 #(word str ptr ptr) +50 pascal SURegQueryValueEx(long str ptr ptr ptr ptr) SURegQueryValueEx +51 stub SURegSetValue +52 stub SURegSetValue16 #(word str long ptr long) +53 stub SURegSetValueEx #(word str long long ptr long) +54 stub SURegSaveKey #(word str ptr) +55 stub SURegLoadKey #(word str str) +56 stub SURegUnLoadKey #(word str) +60 stub DiskInfoFromLdid #(word ptr) +61 pascal suErrorToIds(word word) suErrorToIds16 +62 pascal -ret16 TPWriteProfileString(str str str) TPWriteProfileString16 +63 stub SURPLSETUP +# does SUSTORELDIDPATH set the path of an LDID in the registry ? +64 stub SUSTORELDIDPATH +65 stub WILDCARDSTRCMPI +101 pascal -ret16 GenInstall(word str word) GenInstall16 +102 stub GenWinInitRename #(str str word) +103 pascal GenFormStrWithoutPlaceHolders(str str word) GenFormStrWithoutPlaceHolders16 +104 stub SETUPX +105 stub CfgSetupMerge #(word) +106 stub INITDEPENDANTLDIDS +107 stub CFGOBJFINDKEYCMD +108 stub GenSURegSetValueEx +109 stub GENINSTALLWITHQUEUE +110 stub GenInstallEx #(word str word word ptr long) +111 stub GenCopyLogConfig2Reg #(word word str) +112 stub SUGetSetSetupFlags #(ptr word) +114 stub CFGPARSELINE # returns array +115 stub CFGSETAUTOPROCESS +116 stub CFGOBJTOSTR +117 stub CFGLNTOOBJ +118 stub MATCHCMDEXT +119 stub IpFindNextMatchLine #(word str ptr) +120 stub P_SETDEFAULTOPTION +121 stub CFGCLEANBOOT +122 stub CFGMATCHCMDEXT +123 stub CFGWASFILEUPDATED +124 stub AUTOMATCHCMDEXT +125 stub P_VALIDATEOC +126 stub GENMAPROOTREGSTR2KEY +127 stub P_CDROMOC +128 stub P_MEDIAOC +129 stub CFGCLEAN1STBOOT +130 stub suFormatMessage +131 stub suvFormatMessage #(word str str word ptr) +132 stub suFormatMessageBox +#133 stub suHelp # W98SE conflict !! +135 stub suHelp #(word word) +#135 stub P_WEBTVOC # W98SE conflict !! +136 stub P_WBEMOC +137 stub P_THEMESOC +138 stub P_IMAGINGOC +139 stub P_SCHEMESOC +140 stub suVerConflict #(word ptr word ptr) +141 stub suVerConflictInit #(word) +142 stub suVerConflictTerm #(ptr) +# Emergency Boot Disk +143 stub suCreateEBD #(word ptr long) +144 stub suCopyToEBD +145 stub sxIsMSDOS7Running #() +150 stub DS_INIT +151 stub DS_DESTROY +152 stub DS_SSYNCDRIVES +153 stub DS_GETDRIVEDATA +154 stub DS_ADDSECTION +155 stub DS_ENABLESECTION +156 stub DS_DISABLESECTION +157 stub DS_SETSWAPSIZE +158 stub DS_SETREQUIREDPAD +159 stub DS_SETAVAILABLEPAD +160 stub SXUPDATEDS +170 stub SUSETMEM +171 stub WriteDMFBootData #(word ptr word) +200 pascal VcpOpen(segptr ptr) VcpOpen16 +201 pascal VcpClose(word str) VcpClose16 +202 pascal -ret16 vcpDefCallbackProc(ptr word word long long) vcpDefCallbackProc16 +203 stub vcpEnumFiles #(ptr long) +204 pascal -ret16 VcpQueueRename(str str str str word word long) VcpQueueRename16 +205 pascal -ret16 vsmGetStringName(word ptr word) vsmGetStringName16 +206 pascal -ret16 vsmStringDelete(word) vsmStringDelete16 +207 pascal -ret16 vsmStringAdd(str) vsmStringAdd16 +208 pascal vsmGetStringRawName(word) vsmGetStringRawName16 +209 stub IpSaveRestorePosition #(word word) +210 pascal -ret16 IpGetProfileString(word str str ptr word) IpGetProfileString16 +211 stub IpOpenEx #(str ptr word) +212 stub IpOpenAppendEx #(str word word) +213 pascal -ret16 vcpUICallbackProc(ptr word word long long) vcpUICallbackProc16 +214 stub VcpAddMRUPath #(str) +300 pascal -ret16 DiBuildCompatDrvList (ptr) DiBuildCompatDrvList16 +301 pascal -ret16 DiBuildClassDrvList (ptr) DiBuildClassDrvList16 +302 stub DiDestroyDriverNodeList #(ptr) +303 pascal -ret16 DiCreateDeviceInfo (ptr str long long str str word) DiCreateDeviceInfo16 +304 pascal -ret16 DiGetClassDevs(ptr str word word) DiGetClassDevs16 +305 pascal -ret16 DiDestroyDeviceInfoList (ptr) DiDestroyDeviceInfoList16 +306 stub DiRemoveDevice #(ptr) +308 pascal -ret16 DiCallClassInstaller (word ptr) DiCallClassInstaller16 +309 stub DiCreateDriverNode #(ptr word word word str str str str str str long) +310 stub DiDrawMiniIcon +311 stub DiGetClassBitmapIndex #(str ptr) +312 stub DiSelectDevice #(ptr) +313 stub DiInstallDevice #(ptr) +314 stub DiLoadClassIcon #(str ptr ptr) +315 stub DiAskForOEMDisk #(ptr) +316 stub Display_SetMode #(ptr word word word) +317 stub Display_ClassInstaller #(word ptr) +318 pascal -ret16 DiCreateDevRegKey (ptr ptr word str word) DiCreateDevRegKey16 +319 pascal -ret16 DiOpenDevRegKey (ptr ptr word) DiOpenDevRegKey16 +320 stub DiInstallDrvSection #(str str str str long) +321 stub DiInstallClass #(str long) +322 stub DiOpenClassRegKey #(ptr str) +323 stub Display_SetFontSize #(str) +324 stub Display_OpenFontSizeKey #(ptr) +325 stub DiBuildClassDrvListFromOldInf #(ptr str ptr long) +326 stub DiIsThereNeedToCopy #(word long) +333 stub DiChangeState #(ptr long long long) +334 stub WALKSUBTREE +340 stub GetFctn #(word str str ptr ptr) +341 stub DiBuildClassInfoList #(ptr) +342 stub DiDestroyClassInfoList #(ptr) +343 stub DiGetDeviceClassInfo #(ptr ptr) +344 pascal -ret16 DiDeleteDevRegKey (ptr word) DiDeleteDevRegKey16 +350 stub DiSelectOEMDrv #(word ptr) +351 stub DiGetINFClass #(str word str long) +353 stub DIPICKBESTDRIVER +355 stub COPYINFFILE +360 stub GenInfLCToDevNode #(word str word word long) +361 stub GETDOSMESSAGE +362 stub Mouse_ClassInstaller #(word ptr) +363 stub sxCompareDosAppVer #(str str) +364 stub MONITOR_CLASSINSTALLER +365 stub FCEGETRESDESOFFSET +366 stub FCEGETALLOCVALUE +367 stub FCEADDRESDES +368 stub FCEDELETERESDES +369 stub FCEINIT +370 stub FCEGETRESDES +371 stub FCEGETFIRSTVALUE +372 stub FCEGETOTHERVALUE +373 stub FCEGETVALIDATEVALUE +374 stub FCEWRITETHISFORCEDCONFIGNOW +375 stub SUCreatePropertySheetPage #(ptr) +376 stub SUDestroyPropertySheetPage #(word) +377 stub SUPropertySheet #(ptr) +380 stub DiReadRegLogConf #(ptr str ptr ptr) +381 stub DiReadRegConf #(ptr ptr ptr long) +390 stub DiBuildPotentialDuplicatesList #(ptr ptr long ptr ptr) +395 stub InitSubstrData #(ptr str) +396 stub GetFirstSubstr #(ptr) +397 stub GetNextSubstr #(ptr) +398 stub INITSUBSTRDATAEX +400 stub bIsFileInVMM32 #(str) +401 stub DiInstallDriverFiles #(ptr) +405 stub DiBuildClassInfoListEx #(ptr long) +406 stub DiGetClassDevsEx #(ptr str str word word) +407 stub DiCopyRegSubKeyValue #(word str str str) +408 stub IPGETDRIVERDATE +409 stub IPGETDRIVERVERSION +410 stub IpGetVersionString #(str str ptr word str) +411 pascal VcpExplain(ptr long) VcpExplain16 +412 stub DiBuildDriverIndex #(word) +413 stub DiAddSingleInfToDrvIdx #(str word word) +414 stub FCEGETFLAGS +450 stub UiMakeDlgNonBold #(word) +451 stub UiDeleteNonBoldFont #(word) +500 stub SUEBDPAGE +501 stub SUOCPAGE +502 stub SXLISTSUBPROC +503 stub SXFILLLB +504 stub SXOCPAGEDLG +506 stub SXOCBATCHSETTINGS +507 stub SXOCFIXNEEDS +508 pascal -ret16 CtlSetLddPath(word str) CtlSetLddPath16 +509 stub SXCALLOCPROC +510 stub BUILDINFOCS +511 stub BUILDREGOCS +512 stub DELETEOCS +520 stub DiBuildClassDrvInfoList #(ptr) +521 stub DiBuildCompatDrvInfoList #(ptr) +522 stub DiDestroyDrvInfoList #(ptr) +523 stub DiConvertDriverInfoToDriverNode #(ptr ptr) +524 stub DISELECTBESTCOMPATDRV +525 stub FirstBootMoveToDOSSTART #(str word) +526 stub DOSOptEnableCurCfg #(str) +527 pascal -ret16 InstallHinfSection(word word str word) InstallHinfSection16 +528 stub SXMAKEUNCPATH +529 stub SXISSBSSERVERFILE +530 stub SXFINDBATCHFILES +531 stub ISPANEUROPEAN +532 stub UPGRADENIGGLINGS +533 stub DISPLAY_ISSECONDDISPLAY +534 stub ISWINDOWSFILE +540 stub VERIFYSELECTEDDRIVER +575 stub SXCALLMIGRATIONDLLS +576 stub SXCALLMIGRATIONDLLS_RUNDLL +600 stub PidConstruct #(str str str word) +601 stub PidValidate #(str str) +602 stub GETJAPANESEKEYBOARDTYPE +610 stub CRC32COMPUTE +621 stub SXSAVEINFO +622 stub SXADDPAGEEX +623 stub OPKREMOVEINSTALLEDNETDEVICE +640 stub DOFIRSTRUNSCREENS +700 stub SXSHOWREBOOTDLG +701 stub SXSHOWREBOOTDLG_RUNDLL +750 stub UIPOSITIONDIALOG +775 stub ASPICLEAN +800 stub EXTRACTCABFILE +825 stub PIDGEN3 +826 stub GETSETUPINFO +827 stub SETSETUPINFO +828 stub GETKEYBOARDOPTIONS +829 stub GETLOCALEOPTIONS +830 stub SETINTLOPTIONS +831 stub GETPRODUCTTYPE +832 stub ISOPKMODE +833 stub AUDITONETIMEINSTALL +834 stub DISKDUP +835 stub OPKPREINSTALL +836 stub ISAUDITMODE +837 stub ISAUDITAUTO +838 stub GETVALIDEULA diff --git a/reactos/lib/setupapi/setupx_main.c b/reactos/lib/setupapi/setupx_main.c index 4f5b9525c3b..ca3ac711792 100644 --- a/reactos/lib/setupapi/setupx_main.c +++ b/reactos/lib/setupapi/setupx_main.c @@ -76,6 +76,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi); +#define HINSTANCE_32(h16) ((HINSTANCE)(ULONG_PTR)(h16)) + /*********************************************************************** * SURegOpenKey (SETUPX.47) */ @@ -98,74 +100,6 @@ DWORD WINAPI SURegQueryValueEx( HKEY hkey, LPSTR lpszValueName, lpbData, lpcbData ); } -/* - * Returns pointer to a string list with the first entry being number - * of strings. - * - * Hmm. Should this be InitSubstrData(), GetFirstSubstr() and GetNextSubstr() - * instead? - */ -static LPSTR *SETUPX_GetSubStrings(LPSTR start, char delimiter) -{ - LPSTR p, q; - LPSTR *res = NULL; - DWORD count = 0; - int len; - - p = start; - - while (1) - { - /* find beginning of real substring */ - while ( (*p == ' ') || (*p == '\t') || (*p == '"') ) p++; - - /* find end of real substring */ - q = p; - while ( (*q) - && (*q != ' ') && (*q != '\t') && (*q != '"') - && (*q != ';') && (*q != delimiter) ) q++; - if (q == p) - break; - len = (int)q - (int)p; - - /* alloc entry for new substring in steps of 32 units and copy over */ - if (count % 32 == 0) - { /* 1 for count field + current count + 32 */ - if (res) - res = HeapReAlloc(GetProcessHeap(), 0, res, (1+count+32)*sizeof(LPSTR)); - else - res = HeapAlloc(GetProcessHeap(), 0, (1+count+32)*sizeof(LPSTR)); - } - *(res+1+count) = HeapAlloc(GetProcessHeap(), 0, len+1); - strncpy(*(res+1+count), p, len); - (*(res+1+count))[len] = '\0'; - count++; - - /* we are still within last substring (before delimiter), - * so get out of it */ - while ((*q) && (*q != ';') && (*q != delimiter)) q++; - if ((!*q) || (*q == ';')) - break; - p = q+1; - } - - /* put number of entries at beginning of list */ - *(DWORD *)res = count; - return res; -} - -static void SETUPX_FreeSubStrings(LPSTR *substr) -{ - DWORD count = *(DWORD *)substr; - LPSTR *pStrings = substr+1; - DWORD n; - - for (n=0; n < count; n++) - HeapFree(GetProcessHeap(), 0, *pStrings++); - - HeapFree(GetProcessHeap(), 0, substr); -} - /*********************************************************************** * InstallHinfSection (SETUPX.527) @@ -180,63 +114,8 @@ static void SETUPX_FreeSubStrings(LPSTR *substr) */ RETERR16 WINAPI InstallHinfSection16( HWND16 hwnd, HINSTANCE16 hinst, LPCSTR lpszCmdLine, INT16 nCmdShow) { - LPSTR *pSub; - DWORD count; - HINF16 hInf = 0; - RETERR16 res = OK, tmp; - WORD wFlags; - BOOL reboot = FALSE; - - TRACE("(%04x, %04x, %s, %d);\n", hwnd, hinst, lpszCmdLine, nCmdShow); - - pSub = SETUPX_GetSubStrings((LPSTR)lpszCmdLine, ' '); - - count = *(DWORD *)pSub; - if (count < 2) /* invalid number of arguments ? */ - goto end; - if (IpOpen16(*(pSub+count), &hInf) != OK) - { - res = ERROR_FILE_NOT_FOUND; /* yes, correct */ - goto end; - } - if (VcpOpen16(NULL, 0)) - goto end; - if (GenInstall16(hInf, *(pSub+count-2), GENINSTALL_DO_ALL) != OK) - goto end; - wFlags = atoi(*(pSub+count-1)) & ~128; - switch (wFlags) - { - case HOW_ALWAYS_SILENT_REBOOT: - case HOW_SILENT_REBOOT: - reboot = TRUE; - break; - case HOW_ALWAYS_PROMPT_REBOOT: - case HOW_PROMPT_REBOOT: - if (MessageBoxA(HWND_32(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) - reboot = TRUE; - break; - default: - ERR("invalid flags %d !\n", wFlags); - goto end; - } - - res = OK; -end: - tmp = VcpClose16(VCPFL_ALL, NULL); - if (tmp != OK) - res = tmp; - tmp = IpClose16(hInf); - if (tmp != OK) - res = tmp; - SETUPX_FreeSubStrings(pSub); - if (reboot) - { - /* FIXME: we should have a means of terminating all wine + wineserver */ - MESSAGE("Program or user told me to restart. Exiting Wine...\n"); - ExitProcess(1); - } - - return res; + InstallHinfSectionA( HWND_32(hwnd), HINSTANCE_32(hinst), lpszCmdLine, nCmdShow ); + return OK; } typedef struct diff --git a/reactos/lib/setupapi/stubs.c b/reactos/lib/setupapi/stubs.c index 4208acb0a5f..8465b35f9fa 100644 --- a/reactos/lib/setupapi/stubs.c +++ b/reactos/lib/setupapi/stubs.c @@ -186,4 +186,43 @@ BOOL WINAPI SetupCopyOEMInfA(PCSTR sourceinffile, PCSTR sourcemedialoc, { FIXME("stub: source %s location %s ...\n",sourceinffile, sourcemedialoc); return FALSE; -} \ No newline at end of file +} + +/*********************************************************************** + * SetupGetInfInformationA (SETUPAPI.@) + */ +BOOL WINAPI SetupGetInfInformationA( LPCVOID InfSpec, DWORD SearchControl, + PSP_INF_INFORMATION ReturnBuffer, + DWORD ReturnBufferSize, PDWORD RequiredSize) +{ + FIXME("(%p, %ld, %p, %ld, %p) Stub!\n", + InfSpec, SearchControl, ReturnBuffer, ReturnBufferSize, RequiredSize ); + return TRUE; +} + +/*********************************************************************** + * SetupInitializeFileLogW(SETUPAPI.@) + */ +HANDLE WINAPI SetupInitializeFileLogW(LPWSTR LogFileName, DWORD Flags) +{ + FIXME("Stub %s, 0x%lx\n",debugstr_w(LogFileName),Flags); + return INVALID_HANDLE_VALUE; +} + +/*********************************************************************** + * SetupInitializeFileLogA(SETUPAPI.@) + */ +HANDLE WINAPI SetupInitializeFileLogA(LPSTR LogFileName, DWORD Flags) +{ + FIXME("Stub %s, 0x%lx\n",debugstr_a(LogFileName),Flags); + return INVALID_HANDLE_VALUE; +} + +/*********************************************************************** + * SetupTerminateFileLog(SETUPAPI.@) + */ +BOOL WINAPI SetupTerminateFileLog(HANDLE FileLogHandle) +{ + FIXME ("Stub %p\n",FileLogHandle); + return TRUE; +}