setupapi: Implement SetupQueryInfFileInformation.

This commit is contained in:
James Hawkins 2006-02-07 16:08:33 +01:00 committed by Alexandre Julliard
parent 6cb7ca4177
commit 647329d2dd
3 changed files with 119 additions and 24 deletions

View File

@ -16,6 +16,7 @@ C_SRCS = \
install.c \
misc.c \
parser.c \
query.c \
queue.c \
setupcab.c \
stringtable.c \

118
dlls/setupapi/query.c Normal file
View File

@ -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;
}

View File

@ -174,30 +174,6 @@ BOOL WINAPI SetupGetInfInformationW( LPCVOID InfSpec, DWORD SearchControl,
return TRUE;
}
/***********************************************************************
* 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.@)
*/