ReactOS 0.4.15-dev-7093-g01a8288
query.c File Reference
#include "setupapi_private.h"
Include dependency graph for query.c:

Go to the source code of this file.

Functions

static BOOL fill_inf_info (HINF inf, PSP_INF_INFORMATION buffer, DWORD size, DWORD *required)
 
static HINF search_for_inf (LPCVOID InfSpec, DWORD SearchControl)
 
BOOL WINAPI SetupGetInfInformationA (LPCVOID InfSpec, DWORD SearchControl, PSP_INF_INFORMATION ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupGetInfInformationW (LPCVOID InfSpec, DWORD SearchControl, PSP_INF_INFORMATION ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupQueryInfFileInformationA (PSP_INF_INFORMATION InfInformation, UINT InfIndex, PSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupQueryInfFileInformationW (PSP_INF_INFORMATION InfInformation, UINT InfIndex, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize)
 
BOOL WINAPI SetupGetSourceFileLocationA (HINF hinf, PINFCONTEXT context, PCSTR filename, PUINT source_id, PSTR buffer, DWORD buffer_size, PDWORD required_size)
 
static LPWSTR get_source_id (HINF hinf, PINFCONTEXT context, PCWSTR filename)
 
BOOL WINAPI SetupGetSourceFileLocationW (HINF hinf, PINFCONTEXT context, PCWSTR filename, PUINT source_id, PWSTR buffer, DWORD buffer_size, PDWORD required_size)
 
BOOL WINAPI SetupGetSourceInfoA (HINF hinf, UINT source_id, UINT info, PSTR buffer, DWORD buffer_size, LPDWORD required_size)
 
BOOL WINAPI SetupGetSourceInfoW (HINF hinf, UINT source_id, UINT info, PWSTR buffer, DWORD buffer_size, LPDWORD required_size)
 
BOOL WINAPI SetupGetTargetPathA (HINF hinf, PINFCONTEXT context, PCSTR section, PSTR buffer, DWORD buffer_size, PDWORD required_size)
 
BOOL WINAPI SetupGetTargetPathW (HINF hinf, PINFCONTEXT context, PCWSTR section, PWSTR buffer, DWORD buffer_size, PDWORD required_size)
 
BOOL WINAPI SetupQueryInfOriginalFileInformationA (PSP_INF_INFORMATION InfInformation, UINT InfIndex, PSP_ALTPLATFORM_INFO AlternativePlatformInfo, PSP_ORIGINAL_FILE_INFO_A OriginalFileInfo)
 
BOOL WINAPI SetupQueryInfOriginalFileInformationW (PSP_INF_INFORMATION InfInformation, UINT InfIndex, PSP_ALTPLATFORM_INFO AlternativePlatformInfo, PSP_ORIGINAL_FILE_INFO_W OriginalFileInfo)
 

Variables

static const WCHAR source_disks_names []
 
static const WCHAR source_disks_files []
 

Function Documentation

◆ fill_inf_info()

static BOOL fill_inf_info ( HINF  inf,
PSP_INF_INFORMATION  buffer,
DWORD  size,
DWORD required 
)
static

Definition at line 31 of file query.c.

32{
34 DWORD total_size = FIELD_OFFSET(SP_INF_INFORMATION, VersionData)
35 + (lstrlenW(filename) + 1) * sizeof(WCHAR);
36
37 if (required) *required = total_size;
38
39 /* FIXME: we need to parse the INF file to find the correct version info */
40 if (buffer)
41 {
42 if (size < total_size)
43 {
45 return FALSE;
46 }
47 buffer->InfStyle = INF_STYLE_WIN4;
48 buffer->InfCount = 1;
49 /* put the filename in buffer->VersionData */
50 lstrcpyW((LPWSTR)&buffer->VersionData[0], filename);
51 }
52 return TRUE;
53}
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:752
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
const WCHAR * PARSER_get_inf_filename(HINF hinf)
Definition: parser.c:1084
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr size
Definition: glext.h:5919
GLuint buffer
Definition: glext.h:5915
#define INF_STYLE_WIN4
Definition: infsupp.h:41
const char * filename
Definition: ioapi.h:137
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by SetupGetInfInformationW().

◆ get_source_id()

static LPWSTR get_source_id ( HINF  hinf,
PINFCONTEXT  context,
PCWSTR  filename 
)
static

Definition at line 333 of file query.c.

334{
335 WCHAR Section[MAX_PATH];
336 DWORD size;
338
340 return NULL;
341
342 if (!SetupFindFirstLineW( hinf, Section, filename, context ) &&
344 return NULL;
345
346 if (!SetupGetStringFieldW( context, 1, NULL, 0, &size ))
347 return NULL;
348
349 if (!(source_id = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) )))
350 return NULL;
351
353 {
355 return NULL;
356 }
357
359 {
361 return NULL;
362 }
363
364 if (!SetupFindFirstLineW( hinf, Section, source_id, context ) &&
366 {
368 return NULL;
369 }
370 return source_id;
371}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
BOOL WINAPI SetupDiGetActualSectionToInstallW(HINF InfHandle, PCWSTR InfSectionName, PWSTR InfSectionWithExt, DWORD InfSectionWithExtSize, PDWORD RequiredSize, PWSTR *Extension)
Definition: devinst.c:1980
static const WCHAR source_disks_names[]
Definition: query.c:23
static const WCHAR source_disks_files[]
Definition: query.c:25
static int source_id
Definition: solundo.cpp:15
Definition: http.c:7252
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54

Referenced by SetupGetSourceFileLocationW().

◆ search_for_inf()

static HINF search_for_inf ( LPCVOID  InfSpec,
DWORD  SearchControl 
)
static

Definition at line 55 of file query.c.

56{
58 WCHAR inf_path[MAX_PATH];
59
60 static const WCHAR infW[] = {'\\','i','n','f','\\',0};
61 static const WCHAR system32W[] = {'\\','s','y','s','t','e','m','3','2','\\',0};
62
64 {
66 lstrcatW(inf_path, system32W);
67 lstrcatW(inf_path, InfSpec);
68
69 hInf = SetupOpenInfFileW(inf_path, NULL,
71 if (hInf != INVALID_HANDLE_VALUE)
72 return hInf;
73
75 lstrcpyW(inf_path, infW);
76 lstrcatW(inf_path, InfSpec);
77
78 return SetupOpenInfFileW(inf_path, NULL,
80 }
81
83}
static const WCHAR infW[]
Definition: axinstall.c:35
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
#define INF_STYLE_OLDNT
Definition: infsupp.h:37
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define INFINFO_REVERSE_DEFAULT_SEARCH
Definition: setupapi.h:451
_In_ DWORD SearchControl
Definition: setupapi.h:1954

Referenced by SetupGetInfInformationW().

◆ SetupGetInfInformationA()

BOOL WINAPI SetupGetInfInformationA ( LPCVOID  InfSpec,
DWORD  SearchControl,
PSP_INF_INFORMATION  ReturnBuffer,
DWORD  ReturnBufferSize,
PDWORD  RequiredSize 
)

Definition at line 89 of file query.c.

92{
93 LPWSTR inf = (LPWSTR)InfSpec;
94 DWORD len;
95 BOOL ret;
96
98 {
99 len = MultiByteToWideChar(CP_ACP, 0, InfSpec, -1, NULL, 0);
100 inf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
101 if (!inf)
102 {
104 return FALSE;
105 }
106 MultiByteToWideChar(CP_ACP, 0, InfSpec, -1, inf, len);
107 }
108
109 ret = SetupGetInfInformationW(inf, SearchControl, ReturnBuffer,
111
113 HeapFree(GetProcessHeap(), 0, inf);
114
115 return ret;
116}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
BOOL WINAPI SetupGetInfInformationW(LPCVOID InfSpec, DWORD SearchControl, PSP_INF_INFORMATION ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize)
Definition: query.c:124
unsigned int BOOL
Definition: ntddk_ex.h:94
GLenum GLsizei len
Definition: glext.h:6722
#define INFINFO_INF_NAME_IS_ABSOLUTE
Definition: setupapi.h:449
_In_ DWORD _In_ DWORD ReturnBufferSize
Definition: setupapi.h:1897
int ret
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ ULONG _Out_ PVOID _Out_ PULONG RequiredSize
Definition: wdfdevice.h:4439

Referenced by alloc_inf_info(), test_original_file_name(), and test_SetupGetInfInformation().

◆ SetupGetInfInformationW()

BOOL WINAPI SetupGetInfInformationW ( LPCVOID  InfSpec,
DWORD  SearchControl,
PSP_INF_INFORMATION  ReturnBuffer,
DWORD  ReturnBufferSize,
PDWORD  RequiredSize 
)

Definition at line 124 of file query.c.

127{
128 HINF inf;
129 BOOL ret;
130 DWORD infSize;
131
132 TRACE("(%p, %d, %p, %d, %p)\n", InfSpec, SearchControl, ReturnBuffer,
134
135 if (!InfSpec)
136 {
139 else
141
142 return FALSE;
143 }
144
145 switch (SearchControl)
146 {
148 inf = (HINF)InfSpec;
149 break;
152 inf = SetupOpenInfFileW(InfSpec, NULL,
154 break;
156 inf = search_for_inf(InfSpec, SearchControl);
157 break;
159 FIXME("Unhandled search control: %d\n", SearchControl);
160
161 if (RequiredSize)
162 *RequiredSize = 0;
163
164 return FALSE;
165 default:
167 return FALSE;
168 }
169
170 if (inf == INVALID_HANDLE_VALUE)
171 {
173 return FALSE;
174 }
175
176 ret = fill_inf_info(inf, ReturnBuffer, ReturnBufferSize, &infSize);
177 if (!ReturnBuffer && (ReturnBufferSize >= infSize))
178 {
180 ret = FALSE;
181 }
182 if (RequiredSize) *RequiredSize = infSize;
183
186
187 return ret;
188}
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
static HINF search_for_inf(LPCVOID InfSpec, DWORD SearchControl)
Definition: query.c:55
static BOOL fill_inf_info(HINF inf, PSP_INF_INFORMATION buffer, DWORD size, DWORD *required)
Definition: query.c:31
PVOID HINF
Definition: infsupp.h:21
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define INFINFO_DEFAULT_SEARCH
Definition: setupapi.h:450
#define INFINFO_INF_PATH_LIST_SEARCH
Definition: setupapi.h:452
#define INFINFO_INF_SPEC_IS_HINF
Definition: setupapi.h:448
#define TRACE(s)
Definition: solgame.cpp:4
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43

Referenced by SetupGetInfInformationA().

◆ SetupGetSourceFileLocationA()

BOOL WINAPI SetupGetSourceFileLocationA ( HINF  hinf,
PINFCONTEXT  context,
PCSTR  filename,
PUINT  source_id,
PSTR  buffer,
DWORD  buffer_size,
PDWORD  required_size 
)

Definition at line 288 of file query.c.

291{
292 BOOL ret = FALSE;
293 WCHAR *filenameW = NULL, *bufferW = NULL;
294 DWORD required;
295 INT size;
296
297 TRACE("%p, %p, %s, %p, %p, 0x%08x, %p\n", hinf, context, debugstr_a(filename), source_id,
298 buffer, buffer_size, required_size);
299
300 if (filename && *filename && !(filenameW = strdupAtoW( filename )))
301 return FALSE;
302
303 if (!SetupGetSourceFileLocationW( hinf, context, filenameW, source_id, NULL, 0, &required ))
304 goto done;
305
306 if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, required * sizeof(WCHAR) )))
307 goto done;
308
309 if (!SetupGetSourceFileLocationW( hinf, context, filenameW, source_id, bufferW, required, NULL ))
310 goto done;
311
312 size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
313 if (required_size) *required_size = size;
314
315 if (buffer)
316 {
317 if (buffer_size >= size)
318 WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, buffer_size, NULL, NULL );
319 else
320 {
322 goto done;
323 }
324 }
325 ret = TRUE;
326
327 done:
329 HeapFree( GetProcessHeap(), 0, bufferW );
330 return ret;
331}
static WCHAR * strdupAtoW(const char *str)
Definition: main.c:65
#define WideCharToMultiByte
Definition: compat.h:111
BOOL WINAPI SetupGetSourceFileLocationW(HINF hinf, PINFCONTEXT context, PCWSTR filename, PUINT source_id, PWSTR buffer, DWORD buffer_size, PDWORD required_size)
Definition: query.c:377
#define debugstr_a
Definition: kernel32.h:31
static const WCHAR filenameW[]
Definition: amstream.c:41
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
int32_t INT
Definition: typedefs.h:58

Referenced by test_SetupGetSourceFileLocation().

◆ SetupGetSourceFileLocationW()

BOOL WINAPI SetupGetSourceFileLocationW ( HINF  hinf,
PINFCONTEXT  context,
PCWSTR  filename,
PUINT  source_id,
PWSTR  buffer,
DWORD  buffer_size,
PDWORD  required_size 
)

Definition at line 377 of file query.c.

380{
382 WCHAR *end, *source_id_str;
383
384 TRACE("%p, %p, %s, %p, %p, 0x%08x, %p\n", hinf, context, debugstr_w(filename), source_id,
385 buffer, buffer_size, required_size);
386
387 if (!context) context = &ctx;
388
389 if (!(source_id_str = get_source_id( hinf, context, filename )))
390 return FALSE;
391
392 *source_id = strtolW( source_id_str, &end, 10 );
393 if (end == source_id_str || *end)
394 {
395 HeapFree( GetProcessHeap(), 0, source_id_str );
396 return FALSE;
397 }
398 HeapFree( GetProcessHeap(), 0, source_id_str );
399
400 if (SetupGetStringFieldW( context, 4, buffer, buffer_size, required_size ))
401 return TRUE;
402
403 if (required_size) *required_size = 1;
404 if (buffer)
405 {
406 if (buffer_size >= 1) buffer[0] = 0;
407 else
408 {
410 return FALSE;
411 }
412 }
413 return TRUE;
414}
static LPWSTR get_source_id(HINF hinf, PINFCONTEXT context, PCWSTR filename)
Definition: query.c:333
GLuint GLuint end
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
#define strtolW(s, e, b)
Definition: unicode.h:33

Referenced by SetupGetSourceFileLocationA().

◆ SetupGetSourceInfoA()

BOOL WINAPI SetupGetSourceInfoA ( HINF  hinf,
UINT  source_id,
UINT  info,
PSTR  buffer,
DWORD  buffer_size,
LPDWORD  required_size 
)

Definition at line 420 of file query.c.

422{
423 BOOL ret = FALSE;
424 WCHAR *bufferW = NULL;
425 DWORD required;
426 INT size;
427
428 TRACE("%p, %d, %d, %p, %d, %p\n", hinf, source_id, info, buffer, buffer_size,
429 required_size);
430
431 if (!SetupGetSourceInfoW( hinf, source_id, info, NULL, 0, &required ))
432 return FALSE;
433
434 if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, required * sizeof(WCHAR) )))
435 return FALSE;
436
437 if (!SetupGetSourceInfoW( hinf, source_id, info, bufferW, required, NULL ))
438 goto done;
439
440 size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
441 if (required_size) *required_size = size;
442
443 if (buffer)
444 {
445 if (buffer_size >= size)
446 WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, buffer_size, NULL, NULL );
447 else
448 {
450 goto done;
451 }
452 }
453 ret = TRUE;
454
455 done:
456 HeapFree( GetProcessHeap(), 0, bufferW );
457 return ret;
458}
BOOL WINAPI SetupGetSourceInfoW(HINF hinf, UINT source_id, UINT info, PWSTR buffer, DWORD buffer_size, LPDWORD required_size)
Definition: query.c:464

Referenced by test_SetupGetSourceInfo().

◆ SetupGetSourceInfoW()

BOOL WINAPI SetupGetSourceInfoW ( HINF  hinf,
UINT  source_id,
UINT  info,
PWSTR  buffer,
DWORD  buffer_size,
LPDWORD  required_size 
)

Definition at line 464 of file query.c.

466{
467 WCHAR Section[MAX_PATH];
469 WCHAR source_id_str[11];
470 static const WCHAR fmt[] = {'%','d',0};
471 DWORD index;
472
473 TRACE("%p, %d, %d, %p, %d, %p\n", hinf, source_id, info, buffer, buffer_size,
474 required_size);
475
476 sprintfW( source_id_str, fmt, source_id );
477
479 return FALSE;
480
481 if (!SetupFindFirstLineW( hinf, Section, source_id_str, &ctx ) &&
482 !SetupFindFirstLineW( hinf, source_disks_names, source_id_str, &ctx ))
483 return FALSE;
484
485 switch (info)
486 {
487 case SRCINFO_PATH: index = 4; break;
488 case SRCINFO_TAGFILE: index = 2; break;
489 case SRCINFO_DESCRIPTION: index = 1; break;
490 default:
491 WARN("unknown info level: %d\n", info);
492 return FALSE;
493 }
494
495 if (SetupGetStringFieldW( &ctx, index, buffer, buffer_size, required_size ))
496 return TRUE;
497
498 if (required_size) *required_size = 1;
499 if (buffer)
500 {
501 if (buffer_size >= 1) buffer[0] = 0;
502 else
503 {
505 return FALSE;
506 }
507 }
508 return TRUE;
509}
#define index(s, c)
Definition: various.h:29
#define WARN(fmt,...)
Definition: debug.h:112
GLuint index
Definition: glext.h:6031
#define sprintfW
Definition: unicode.h:58
#define SRCINFO_DESCRIPTION
Definition: setupapi.h:642
#define SRCINFO_TAGFILE
Definition: setupapi.h:641
#define SRCINFO_PATH
Definition: setupapi.h:640
Definition: dsound.c:943

Referenced by SetupGetSourceInfoA().

◆ SetupGetTargetPathA()

BOOL WINAPI SetupGetTargetPathA ( HINF  hinf,
PINFCONTEXT  context,
PCSTR  section,
PSTR  buffer,
DWORD  buffer_size,
PDWORD  required_size 
)

Definition at line 515 of file query.c.

517{
518 BOOL ret = FALSE;
519 WCHAR *sectionW = NULL, *bufferW = NULL;
520 DWORD required;
521 INT size;
522
523 TRACE("%p, %p, %s, %p, 0x%08x, %p\n", hinf, context, debugstr_a(section), buffer,
524 buffer_size, required_size);
525
526 if (section && !(sectionW = strdupAtoW( section )))
527 return FALSE;
528
529 if (!SetupGetTargetPathW( hinf, context, sectionW, NULL, 0, &required ))
530 goto done;
531
532 if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, required * sizeof(WCHAR) )))
533 goto done;
534
535 if (!SetupGetTargetPathW( hinf, context, sectionW, bufferW, required, NULL ))
536 goto done;
537
538 size = WideCharToMultiByte( CP_ACP, 0, bufferW, -1, NULL, 0, NULL, NULL );
539 if (required_size) *required_size = size;
540
541 if (buffer)
542 {
543 if (buffer_size >= size)
544 WideCharToMultiByte( CP_ACP, 0, bufferW, -1, buffer, buffer_size, NULL, NULL );
545 else
546 {
548 goto done;
549 }
550 }
551 ret = TRUE;
552
553 done:
554 HeapFree( GetProcessHeap(), 0, sectionW );
555 HeapFree( GetProcessHeap(), 0, bufferW );
556 return ret;
557}
BOOL WINAPI SetupGetTargetPathW(HINF hinf, PINFCONTEXT context, PCWSTR section, PWSTR buffer, DWORD buffer_size, PDWORD required_size)
Definition: query.c:563
Definition: parser.c:56

Referenced by test_SetupGetTargetPath().

◆ SetupGetTargetPathW()

BOOL WINAPI SetupGetTargetPathW ( HINF  hinf,
PINFCONTEXT  context,
PCWSTR  section,
PWSTR  buffer,
DWORD  buffer_size,
PDWORD  required_size 
)

Definition at line 563 of file query.c.

565{
566 static const WCHAR destination_dirs[] =
567 {'D','e','s','t','i','n','a','t','i','o','n','D','i','r','s',0};
568 static const WCHAR default_dest_dir[] =
569 {'D','e','f','a','u','l','t','D','e','s','t','D','i','r',0};
570
572 WCHAR *dir, systemdir[MAX_PATH];
573 unsigned int size;
574 BOOL ret = FALSE;
575
576 TRACE("%p, %p, %s, %p, 0x%08x, %p\n", hinf, context, debugstr_w(section), buffer,
577 buffer_size, required_size);
578
579 if (context) ret = SetupFindFirstLineW( hinf, destination_dirs, NULL, context );
580 else if (section)
581 {
582 if (!(ret = SetupFindFirstLineW( hinf, destination_dirs, section, &ctx )))
583 ret = SetupFindFirstLineW( hinf, destination_dirs, default_dest_dir, &ctx );
584 }
585 if (!ret || !(dir = PARSER_get_dest_dir( context ? context : &ctx )))
586 {
587 GetSystemDirectoryW( systemdir, MAX_PATH );
588 dir = systemdir;
589 }
590 size = strlenW( dir ) + 1;
591 if (required_size) *required_size = size;
592
593 if (buffer)
594 {
595 if (buffer_size >= size)
596 lstrcpyW( buffer, dir );
597 else
598 {
600 if (dir != systemdir) HeapFree( GetProcessHeap(), 0, dir );
601 return FALSE;
602 }
603 }
604 if (dir != systemdir) HeapFree( GetProcessHeap(), 0, dir );
605 return TRUE;
606}
unsigned int dir
Definition: maze.c:112
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
WCHAR * PARSER_get_dest_dir(INFCONTEXT *context)
Definition: parser.c:1116
#define strlenW(s)
Definition: unicode.h:28

Referenced by SetupGetTargetPathA().

◆ SetupQueryInfFileInformationA()

BOOL WINAPI SetupQueryInfFileInformationA ( PSP_INF_INFORMATION  InfInformation,
UINT  InfIndex,
PSTR  ReturnBuffer,
DWORD  ReturnBufferSize,
PDWORD  RequiredSize 
)

Definition at line 193 of file query.c.

196{
198 DWORD size;
199 BOOL ret;
200
201 ret = SetupQueryInfFileInformationW(InfInformation, InfIndex, NULL, 0, &size);
202 if (!ret)
203 return FALSE;
204
205 filenameW = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR));
206
207 ret = SetupQueryInfFileInformationW(InfInformation, InfIndex,
208 filenameW, size, &size);
209 if (!ret)
210 {
212 return FALSE;
213 }
214
215 if (RequiredSize)
217
218 if (!ReturnBuffer)
219 {
222 {
224 return FALSE;
225 }
226
227 return TRUE;
228 }
229
231 {
234 return FALSE;
235 }
236
237 WideCharToMultiByte(CP_ACP, 0, filenameW, -1, ReturnBuffer, size, NULL, NULL);
239
240 return ret;
241}
BOOL WINAPI SetupQueryInfFileInformationW(PSP_INF_INFORMATION InfInformation, UINT InfIndex, PWSTR ReturnBuffer, DWORD ReturnBufferSize, PDWORD RequiredSize)
Definition: query.c:246

Referenced by check_info_filename().

◆ SetupQueryInfFileInformationW()

BOOL WINAPI SetupQueryInfFileInformationW ( PSP_INF_INFORMATION  InfInformation,
UINT  InfIndex,
PWSTR  ReturnBuffer,
DWORD  ReturnBufferSize,
PDWORD  RequiredSize 
)

Definition at line 246 of file query.c.

249{
250 DWORD len;
251 LPWSTR ptr;
252
253 TRACE("(%p, %u, %p, %d, %p) Stub!\n", InfInformation, InfIndex,
254 ReturnBuffer, ReturnBufferSize, RequiredSize);
255
256 if (!InfInformation)
257 {
259 return FALSE;
260 }
261
262 if (InfIndex != 0)
263 FIXME("Appended INF files are not handled\n");
264
265 ptr = (LPWSTR)InfInformation->VersionData;
266 len = lstrlenW(ptr);
267
268 if (RequiredSize)
269 *RequiredSize = len + 1;
270
271 if (!ReturnBuffer)
272 return TRUE;
273
274 if (ReturnBufferSize < len)
275 {
277 return FALSE;
278 }
279
280 lstrcpyW(ReturnBuffer, ptr);
281 return TRUE;
282}
static PVOID ptr
Definition: dispmode.c:27
BYTE VersionData[ANYSIZE_ARRAY]
Definition: setupapi.h:693

Referenced by SetupQueryInfFileInformationA().

◆ SetupQueryInfOriginalFileInformationA()

BOOL WINAPI SetupQueryInfOriginalFileInformationA ( PSP_INF_INFORMATION  InfInformation,
UINT  InfIndex,
PSP_ALTPLATFORM_INFO  AlternativePlatformInfo,
PSP_ORIGINAL_FILE_INFO_A  OriginalFileInfo 
)

Definition at line 611 of file query.c.

615{
616 BOOL ret;
617 SP_ORIGINAL_FILE_INFO_W OriginalFileInfoW;
618
619 TRACE("(%p, %d, %p, %p)\n", InfInformation, InfIndex,
620 AlternativePlatformInfo, OriginalFileInfo);
621
622 if (OriginalFileInfo->cbSize != sizeof(*OriginalFileInfo))
623 {
624 WARN("incorrect OriginalFileInfo->cbSize of %d\n", OriginalFileInfo->cbSize);
626 return FALSE;
627 }
628
629 OriginalFileInfoW.cbSize = sizeof(OriginalFileInfoW);
630 ret = SetupQueryInfOriginalFileInformationW(InfInformation, InfIndex,
631 AlternativePlatformInfo, &OriginalFileInfoW);
632 if (ret)
633 {
634 WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalInfName, -1,
635 OriginalFileInfo->OriginalInfName, MAX_PATH, NULL, NULL);
636 WideCharToMultiByte(CP_ACP, 0, OriginalFileInfoW.OriginalCatalogName, -1,
637 OriginalFileInfo->OriginalCatalogName, MAX_PATH, NULL, NULL);
638 }
639
640 return ret;
641}
BOOL WINAPI SetupQueryInfOriginalFileInformationW(PSP_INF_INFORMATION InfInformation, UINT InfIndex, PSP_ALTPLATFORM_INFO AlternativePlatformInfo, PSP_ORIGINAL_FILE_INFO_W OriginalFileInfo)
Definition: query.c:646
CHAR OriginalCatalogName[MAX_PATH]
Definition: setupapi.h:739
CHAR OriginalInfName[MAX_PATH]
Definition: setupapi.h:738
WCHAR OriginalCatalogName[MAX_PATH]
Definition: setupapi.h:744
WCHAR OriginalInfName[MAX_PATH]
Definition: setupapi.h:743
#define ERROR_INVALID_USER_BUFFER
Definition: winerror.h:1091

◆ SetupQueryInfOriginalFileInformationW()

BOOL WINAPI SetupQueryInfOriginalFileInformationW ( PSP_INF_INFORMATION  InfInformation,
UINT  InfIndex,
PSP_ALTPLATFORM_INFO  AlternativePlatformInfo,
PSP_ORIGINAL_FILE_INFO_W  OriginalFileInfo 
)

Definition at line 646 of file query.c.

650{
651 LPCWSTR inf_name;
652 LPCWSTR inf_path;
653 HINF hinf;
654 static const WCHAR wszVersion[] = { 'V','e','r','s','i','o','n',0 };
655 static const WCHAR wszCatalogFile[] = { 'C','a','t','a','l','o','g','F','i','l','e',0 };
656
657 FIXME("(%p, %d, %p, %p): semi-stub\n", InfInformation, InfIndex,
658 AlternativePlatformInfo, OriginalFileInfo);
659
660 if (OriginalFileInfo->cbSize != sizeof(*OriginalFileInfo))
661 {
662 WARN("incorrect OriginalFileInfo->cbSize of %d\n", OriginalFileInfo->cbSize);
664 return FALSE;
665 }
666
667 inf_path = (LPWSTR)InfInformation->VersionData;
668
669 /* FIXME: we should get OriginalCatalogName from CatalogFile line in
670 * the original inf file and cache it, but that would require building a
671 * .pnf file. */
672 hinf = SetupOpenInfFileW(inf_path, NULL, INF_STYLE_WIN4, NULL);
673 if (hinf == INVALID_HANDLE_VALUE) return FALSE;
674
675 if (!SetupGetLineTextW(NULL, hinf, wszVersion, wszCatalogFile,
676 OriginalFileInfo->OriginalCatalogName,
677 sizeof(OriginalFileInfo->OriginalCatalogName)/sizeof(OriginalFileInfo->OriginalCatalogName[0]),
678 NULL))
679 {
680 OriginalFileInfo->OriginalCatalogName[0] = '\0';
681 }
682 SetupCloseInfFile(hinf);
683
684 /* FIXME: not quite correct as we just return the same file name as
685 * destination (copied) inf file, not the source (original) inf file.
686 * to fix it properly would require building a .pnf file */
687 /* file name is stored in VersionData field of InfInformation */
688 inf_name = strrchrW(inf_path, '\\');
689 if (inf_name) inf_name++;
690 else inf_name = inf_path;
691
692 strcpyW(OriginalFileInfo->OriginalInfName, inf_name);
693
694 return TRUE;
695}
BOOL WINAPI SetupGetLineTextW(PINFCONTEXT context, HINF hinf, PCWSTR section_name, PCWSTR key_name, PWSTR buffer, DWORD size, PDWORD required)
Definition: parser.c:1756
#define strrchrW(s, c)
Definition: unicode.h:35
#define strcpyW(d, s)
Definition: unicode.h:29

Referenced by SetupQueryInfOriginalFileInformationA().

Variable Documentation

◆ source_disks_files

const WCHAR source_disks_files[]
static
Initial value:
=
{'S','o','u','r','c','e','D','i','s','k','s','F','i','l','e','s',0}

Definition at line 25 of file query.c.

Referenced by get_source_id().

◆ source_disks_names

const WCHAR source_disks_names[]
static
Initial value:
=
{'S','o','u','r','c','e','D','i','s','k','s','N','a','m','e','s',0}

Definition at line 23 of file query.c.

Referenced by get_source_id(), and SetupGetSourceInfoW().