Module: wine Branch: refs/heads/master Commit: 647329d2dda7e1684af3ace6e00921231db60604 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=647329d2dda7e1684af3ace6...
Author: James Hawkins truiken@gmail.com Date: Tue Feb 7 16:08:33 2006 +0100
setupapi: Implement SetupQueryInfFileInformation.
---
dlls/setupapi/Makefile.in | 1 dlls/setupapi/query.c | 118 +++++++++++++++++++++++++++++++++++++++++++++ dlls/setupapi/stubs.c | 24 --------- 3 files changed, 119 insertions(+), 24 deletions(-) create mode 100644 dlls/setupapi/query.c
diff --git a/dlls/setupapi/Makefile.in b/dlls/setupapi/Makefile.in index fb36bd1..9ee9a90 100644 --- a/dlls/setupapi/Makefile.in +++ b/dlls/setupapi/Makefile.in @@ -16,6 +16,7 @@ C_SRCS = \ install.c \ misc.c \ parser.c \ + query.c \ queue.c \ setupcab.c \ stringtable.c \ diff --git a/dlls/setupapi/query.c b/dlls/setupapi/query.c new file mode 100644 index 0000000..9a48a4b --- /dev/null +++ b/dlls/setupapi/query.c @@ -0,0 +1,118 @@ +/* + * setupapi query functions + * + * Copyright 2006 James Hawkins + * + * 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 <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winreg.h" +#include "winver.h" +#include "setupapi.h" +#include "advpub.h" +#include "winnls.h" +#include "wine/debug.h" +#include "setupapi_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(setupapi); + +/*********************************************************************** + * SetupQueryInfFileInformationA (SETUPAPI.@) + */ +BOOL WINAPI SetupQueryInfFileInformationA(PSP_INF_INFORMATION InfInformation, + UINT InfIndex, PSTR ReturnBuffer, + DWORD ReturnBufferSize, PDWORD RequiredSize) +{ + LPWSTR filenameW; + DWORD size; + BOOL ret; + + ret = SetupQueryInfFileInformationW(InfInformation, InfIndex, NULL, 0, &size); + if (!ret) + return FALSE; + + filenameW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); + + ret = SetupQueryInfFileInformationW(InfInformation, InfIndex, + filenameW, size, &size); + if (!ret) + { + HeapFree(GetProcessHeap(), 0, filenameW); + return FALSE; + } + + if (RequiredSize) + *RequiredSize = size; + + if (!ReturnBuffer) + return TRUE; + + if (size > ReturnBufferSize) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + WideCharToMultiByte(CP_ACP, 0, filenameW, -1, ReturnBuffer, size, NULL, NULL); + HeapFree(GetProcessHeap(), 0, filenameW); + + return ret; +} + +/*********************************************************************** + * SetupQueryInfFileInformationW (SETUPAPI.@) + */ +BOOL WINAPI SetupQueryInfFileInformationW(PSP_INF_INFORMATION InfInformation, + UINT InfIndex, PWSTR ReturnBuffer, + DWORD ReturnBufferSize, PDWORD RequiredSize) +{ + DWORD len; + LPWSTR ptr; + + TRACE("(%p, %u, %p, %ld, %p) Stub!\n", InfInformation, InfIndex, + ReturnBuffer, ReturnBufferSize, RequiredSize); + + if (!InfInformation) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (InfIndex != 0) + FIXME("Appended INF files are not handled\n"); + + ptr = (LPWSTR)&InfInformation->VersionData[0]; + len = lstrlenW(ptr); + + if (RequiredSize) + *RequiredSize = len + 1; + + if (!ReturnBuffer) + return TRUE; + + if (ReturnBufferSize < len) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + lstrcpyW(ReturnBuffer, ptr); + return TRUE; +} diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c index 59adb78..1909454 100644 --- a/dlls/setupapi/stubs.c +++ b/dlls/setupapi/stubs.c @@ -175,30 +175,6 @@ BOOL WINAPI SetupGetInfInformationW( LPC }
/*********************************************************************** - * SetupQueryInfFileInformationA (SETUPAPI.@) - */ -BOOL WINAPI SetupQueryInfFileInformationA(PSP_INF_INFORMATION InfInformation, - UINT InfIndex, PSTR ReturnBuffer, - DWORD ReturnBufferSize, PDWORD RequiredSize) -{ - FIXME("(%p, %u, %p, %ld, %p) Stub!\n", - InfInformation, InfIndex, ReturnBuffer, ReturnBufferSize, RequiredSize ); - return TRUE; -} - -/*********************************************************************** - * SetupQueryInfFileInformationW (SETUPAPI.@) - */ -BOOL WINAPI SetupQueryInfFileInformationW(PSP_INF_INFORMATION InfInformation, - UINT InfIndex, PWSTR ReturnBuffer, - DWORD ReturnBufferSize, PDWORD RequiredSize) -{ - FIXME("(%p, %u, %p, %ld, %p) Stub!\n", - InfInformation, InfIndex, ReturnBuffer, ReturnBufferSize, RequiredSize ); - return TRUE; -} - -/*********************************************************************** * SetupInitializeFileLogW(SETUPAPI.@) */ HANDLE WINAPI SetupInitializeFileLogW(LPWSTR LogFileName, DWORD Flags)