ReactOS  0.4.14-dev-297-g23e575c
setupcab.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
#include "setupapi.h"
#include "wine/test.h"
Include dependency graph for setupcab.c:

Go to the source code of this file.

Classes

struct  contextA
 
struct  contextW
 

Functions

static void create_source_fileA (LPSTR filename, const BYTE *data, DWORD size)
 
static void create_source_fileW (LPWSTR filename, const BYTE *data, DWORD size)
 
static UINT CALLBACK dummy_callbackA (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static UINT CALLBACK dummy_callbackW (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static void test_invalid_parametersA (void)
 
static void test_invalid_parametersW (void)
 
static UINT CALLBACK crash_callbackA (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static UINT CALLBACK crash_callbackW (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static void test_invalid_callbackA (void)
 
static void test_invalid_callbackW (void)
 
static UINT CALLBACK simple_callbackA (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static void test_simple_enumerationA (void)
 
static UINT CALLBACK simple_callbackW (PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
 
static void test_simple_enumerationW (void)
 
 START_TEST (setupcab)
 

Variables

static const BYTE comp_cab_zip_multi []
 
static const WCHAR docW [] = {'d','o','c',0}
 
static const charexpected_files [] = {"tristram", "wine", "shandy"}
 
struct contextA section_names []
 
static const WCHAR tristramW [] = {'t','r','i','s','t','r','a','m',0}
 
static const WCHAR wineW [] = {'w','i','n','e',0}
 
static const WCHAR shandyW [] = {'s','h','a','n','d','y',0}
 
static const WCHARexpected_filesW [] = {tristramW, wineW, shandyW}
 

Function Documentation

◆ crash_callbackA()

static UINT CALLBACK crash_callbackA ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 225 of file setupcab.c.

227 {
228  *(volatile char*)0 = 2;
229  return 0;
230 }

Referenced by test_invalid_callbackA().

◆ crash_callbackW()

static UINT CALLBACK crash_callbackW ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 232 of file setupcab.c.

234 {
235  *(volatile char*)0 = 2;
236  return 0;
237 }

Referenced by test_invalid_callbackW().

◆ create_source_fileA()

static void create_source_fileA ( LPSTR  filename,
const BYTE data,
DWORD  size 
)
static

Definition at line 47 of file setupcab.c.

48 {
49  HANDLE handle;
50  DWORD written;
51 
54  WriteFile(handle, data, size, &written, NULL);
56 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define CloseHandle
Definition: compat.h:398
const char * filename
Definition: ioapi.h:135
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define CREATE_ALWAYS
Definition: disk.h:72
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by test_invalid_callbackA(), test_invalid_parametersA(), and test_simple_enumerationA().

◆ create_source_fileW()

static void create_source_fileW ( LPWSTR  filename,
const BYTE data,
DWORD  size 
)
static

Definition at line 58 of file setupcab.c.

59 {
60  HANDLE handle;
61  DWORD written;
62 
65  WriteFile(handle, data, size, &written, NULL);
67 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define CloseHandle
Definition: compat.h:398
const char * filename
Definition: ioapi.h:135
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define CREATE_ALWAYS
Definition: disk.h:72
#define CreateFileW
Definition: compat.h:400

Referenced by test_invalid_callbackW(), test_invalid_parametersW(), and test_simple_enumerationW().

◆ dummy_callbackA()

static UINT CALLBACK dummy_callbackA ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 69 of file setupcab.c.

71 {
72  ok(0, "Received unexpected notification (%p, %u, %lu, %lu)\n", Context,
73  Notification, Param1, Param2);
74  return 0;
75 }
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_invalid_parametersA().

◆ dummy_callbackW()

static UINT CALLBACK dummy_callbackW ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 77 of file setupcab.c.

79 {
80  ok(0, "Received unexpected notification (%p, %u, %lu, %lu)\n", Context,
81  Notification, Param1, Param2);
82  return 0;
83 }
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_invalid_parametersW().

◆ simple_callbackA()

static UINT CALLBACK simple_callbackA ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 309 of file setupcab.c.

311 {
312  static int index;
313  struct contextA *ctx = Context;
314 
315  switch (Notification)
316  {
318  {
319  CABINET_INFO_A *info = (CABINET_INFO_A *)Param1;
320 
321  ok(!strcmp(info->CabinetFile, ""),
322  "Expected empty CabinetFile, got \"%s\"\n", info->CabinetFile);
323 
324  index = 0;
325  return NO_ERROR;
326  }
328  {
330  const char *cabinet_file = (const char *)Param2;
331 
332  ctx->count++;
333 
335  {
336  ok(!strcmp(expected_files[index], info->NameInCabinet),
337  "[%d] Expected file \"%s\", got \"%s\"\n",
338  index, expected_files[index], info->NameInCabinet);
339  ok(!strcmp(ctx->cabinet, cabinet_file),
340  "[%d] Expected cabinet \"%s\", got \"%s\"\n",
341  index, ctx->cabinet, cabinet_file);
342 
343  strcpy(info->FullTargetName, ctx->target);
344  return FILEOP_DOIT;
345  }
346  else
347  {
348  ok(0, "Unexpectedly enumerated more than number of files in cabinet, index = %d\n", index);
349  return FILEOP_ABORT;
350  }
351  }
353  {
354  FILEPATHS_A *info = (FILEPATHS_A *)Param1;
355 
356  ok(!strcmp(ctx->cabinet, info->Source),
357  "[%d] Expected cabinet \"%s\", got \"%s\"\n",
358  index, ctx->cabinet, info->Source);
359  ok(!strcmp(ctx->target, info->Target),
360  "[%d] Expected target \"%s\", got \"%s\"\n",
361  index, ctx->target, info->Target);
362  ok(info->Win32Error == 0,
363  "[%d] Expected Win32Error 0, got %u\n",
364  index, info->Win32Error);
365 
366  index++;
367  return NO_ERROR;
368  }
369  default:
370  return NO_ERROR;
371  }
372 }
#define SPFILENOTIFY_FILEEXTRACTED
Definition: setupapi.h:559
static const char * expected_files[]
Definition: setupcab.c:300
const char * target
Definition: setupcab.c:306
#define NO_ERROR
Definition: dderror.h:5
#define FILEOP_ABORT
Definition: fileqsup.h:47
GLuint index
Definition: glext.h:6031
#define SPFILENOTIFY_CABINETINFO
Definition: setupapi.h:556
#define FILEOP_DOIT
Definition: fileqsup.h:48
#define index(s, c)
Definition: various.h:29
#define SPFILENOTIFY_FILEINCABINET
Definition: setupapi.h:557
const char * cabinet
Definition: setupcab.c:305
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
int count
Definition: setupcab.c:304
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
struct tagContext Context
Definition: acpixf.h:1024
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by test_simple_enumerationA().

◆ simple_callbackW()

static UINT CALLBACK simple_callbackW ( PVOID  Context,
UINT  Notification,
UINT_PTR  Param1,
UINT_PTR  Param2 
)
static

Definition at line 410 of file setupcab.c.

412 {
413  static const WCHAR emptyW[] = {0};
414  static int index;
415  struct contextW *ctx = Context;
416 
417  switch (Notification)
418  {
420  {
421  CABINET_INFO_W *info = (CABINET_INFO_W *)Param1;
422 
423  ok(!lstrcmpW(info->CabinetFile, emptyW),
424  "Expected empty CabinetFile, got %s\n", wine_dbgstr_w(info->CabinetFile));
425 
426  index = 0;
427  return NO_ERROR;
428  }
430  {
432  const WCHAR *cabinet_file = (const WCHAR *)Param2;
433 
434  ctx->count++;
435 
437  {
438  ok(!lstrcmpW(expected_filesW[index], info->NameInCabinet),
439  "[%d] Expected file %s, got %s\n",
441  ok(!lstrcmpW(ctx->cabinet, cabinet_file),
442  "[%d] Expected cabinet %s, got %s\n",
443  index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(cabinet_file));
444 
445  lstrcpyW(info->FullTargetName, ctx->target);
446  return FILEOP_DOIT;
447  }
448  else
449  {
450  ok(0, "Unexpectedly enumerated more than number of files in cabinet, index = %d\n", index);
451  return FILEOP_ABORT;
452  }
453  }
455  {
456  FILEPATHS_W *info = (FILEPATHS_W *)Param1;
457 
458  ok(!lstrcmpW(ctx->cabinet, info->Source),
459  "[%d] Expected cabinet %s, got %s\n",
460  index, wine_dbgstr_w(ctx->cabinet), wine_dbgstr_w(info->Source));
461  ok(!lstrcmpW(ctx->target, info->Target),
462  "[%d] Expected target %s, got %s\n",
463  index, wine_dbgstr_w(ctx->target), wine_dbgstr_w(info->Target));
464  ok(info->Win32Error == 0,
465  "[%d] Expected Win32Error 0, got %u\n",
466  index, info->Win32Error);
467 
468  index++;
469  return NO_ERROR;
470  }
471  default:
472  return NO_ERROR;
473  }
474 }
const WCHAR * target
Definition: setupcab.c:407
#define SPFILENOTIFY_FILEEXTRACTED
Definition: setupapi.h:559
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define NO_ERROR
Definition: dderror.h:5
const WCHAR * cabinet
Definition: setupcab.c:406
#define FILEOP_ABORT
Definition: fileqsup.h:47
GLuint index
Definition: glext.h:6031
int count
Definition: setupcab.c:405
#define SPFILENOTIFY_CABINETINFO
Definition: setupapi.h:556
#define FILEOP_DOIT
Definition: fileqsup.h:48
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define index(s, c)
Definition: various.h:29
#define SPFILENOTIFY_FILEINCABINET
Definition: setupapi.h:557
static const WCHAR emptyW[]
Definition: navigate.c:40
#define lstrcpyW
Definition: compat.h:406
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
static const WCHAR * expected_filesW[]
Definition: setupcab.c:401
struct tagContext Context
Definition: acpixf.h:1024

Referenced by test_simple_enumerationW().

◆ START_TEST()

START_TEST ( setupcab  )

Definition at line 507 of file setupcab.c.

508 {
511 
512  /* Tests crash on NT4/Win9x/Win2k and Wine. */
513  if (0)
514  {
517  }
518 
521 }
static void test_invalid_callbackA(void)
Definition: setupcab.c:239
static void test_invalid_parametersA(void)
Definition: setupcab.c:85
static void test_invalid_parametersW(void)
Definition: setupcab.c:143
static void test_simple_enumerationA(void)
Definition: setupcab.c:374
static void test_invalid_callbackW(void)
Definition: setupcab.c:266
static void test_simple_enumerationW(void)
Definition: setupcab.c:476

◆ test_invalid_callbackA()

static void test_invalid_callbackA ( void  )
static

Definition at line 239 of file setupcab.c.

240 {
241  BOOL ret;
242  char source[MAX_PATH], temp[MAX_PATH];
243 
244  GetTempPathA(sizeof(temp), temp);
245  GetTempFileNameA(temp, "doc", 0, source);
246 
248 
249  SetLastError(0xdeadbeef);
251  ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
253  "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
254  GetLastError());
255 
256  SetLastError(0xdeadbeef);
258  ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
260  "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
261  GetLastError());
262 
264 }
BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_A MsgHandler, PVOID Context)
Definition: setupcab.c:510
static UINT CALLBACK crash_callbackA(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: setupcab.c:225
static const BYTE comp_cab_zip_multi[]
Definition: setupcab.c:32
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define MAX_PATH
Definition: compat.h:26
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ERROR_INVALID_DATA
Definition: winerror.h:116
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
static calc_node_t temp
Definition: rpn_ieee.c:38
#define ok(value,...)
Definition: atltest.h:57
static void create_source_fileA(LPSTR filename, const BYTE *data, DWORD size)
Definition: setupcab.c:47
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26

Referenced by START_TEST().

◆ test_invalid_callbackW()

static void test_invalid_callbackW ( void  )
static

Definition at line 266 of file setupcab.c.

267 {
268  BOOL ret;
270 
273  {
274  win_skip("SetupIterateCabinetW is not available\n");
275  return;
276  }
277 
280 
282 
283  SetLastError(0xdeadbeef);
285  ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
287  "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
288  GetLastError());
289 
290  SetLastError(0xdeadbeef);
292  ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
294  "Expected GetLastError() to return ERROR_INVALID_DATA, got %u\n",
295  GetLastError());
296 
298 }
static const BYTE comp_cab_zip_multi[]
Definition: setupcab.c:32
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context)
Definition: setupcab.c:575
static void create_source_fileW(LPWSTR filename, const BYTE *data, DWORD size)
Definition: setupcab.c:58
static UINT CALLBACK crash_callbackW(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: setupcab.c:232
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ERROR_INVALID_DATA
Definition: winerror.h:116
static calc_node_t temp
Definition: rpn_ieee.c:38
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static const WCHAR docW[]
Definition: setupcab.c:45
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_invalid_parametersA()

static void test_invalid_parametersA ( void  )
static

Definition at line 85 of file setupcab.c.

86 {
87  BOOL ret;
88  char source[MAX_PATH], temp[MAX_PATH];
89  int i;
90 
91  const struct
92  {
93  PCSTR CabinetFile;
94  PSP_FILE_CALLBACK_A MsgHandler;
95  DWORD expected_lasterror;
96  int todo_lasterror;
97  } invalid_parameters[] =
98  {
101  {"c:\\nonexistent.cab", NULL, ERROR_FILE_NOT_FOUND},
102  {"c:\\nonexistent.cab", dummy_callbackA, ERROR_FILE_NOT_FOUND},
105  };
106 
107  GetTempPathA(sizeof(temp), temp);
108  GetTempFileNameA(temp, "doc", 0, source);
109 
111 
112  for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
113  {
114  SetLastError(0xdeadbeef);
115  ret = SetupIterateCabinetA(invalid_parameters[i].CabinetFile, 0,
116  invalid_parameters[i].MsgHandler, NULL);
117  ok(!ret, "[%d] Expected SetupIterateCabinetA to return 0, got %d\n", i, ret);
118  todo_wine_if (invalid_parameters[i].todo_lasterror)
119  ok(GetLastError() == invalid_parameters[i].expected_lasterror,
120  "[%d] Expected GetLastError() to return %u, got %u\n",
121  i, invalid_parameters[i].expected_lasterror, GetLastError());
122  }
123 
124  SetLastError(0xdeadbeef);
125  ret = SetupIterateCabinetA("", 0, NULL, NULL);
126  ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
128  GetLastError() == ERROR_FILE_NOT_FOUND, /* Win9x/NT4/Win2k */
129  "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
130  GetLastError());
131 
132  SetLastError(0xdeadbeef);
134  ok(!ret, "Expected SetupIterateCabinetA to return 0, got %d\n", ret);
136  GetLastError() == ERROR_FILE_NOT_FOUND, /* Win9x/NT4/Win2k */
137  "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
138  GetLastError());
139 
141 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_A MsgHandler, PVOID Context)
Definition: setupcab.c:510
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
UINT(CALLBACK * PSP_FILE_CALLBACK_A)(PVOID, UINT, UINT_PTR, UINT_PTR)
Definition: setupapi.h:871
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define todo_wine_if(is_todo)
Definition: test.h:155
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ERROR_INVALID_DATA
Definition: winerror.h:116
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
static calc_node_t temp
Definition: rpn_ieee.c:38
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
static void create_source_fileA(LPSTR filename, const BYTE *data, DWORD size)
Definition: setupcab.c:47
const char * PCSTR
Definition: typedefs.h:51
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
static UINT CALLBACK dummy_callbackA(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: setupcab.c:69

Referenced by START_TEST().

◆ test_invalid_parametersW()

static void test_invalid_parametersW ( void  )
static

Definition at line 143 of file setupcab.c.

144 {
145  static const WCHAR nonexistentW[] = {'c',':','\\','n','o','n','e','x','i','s','t','e','n','t','.','c','a','b',0};
146  static const WCHAR emptyW[] = {0};
147 
148  BOOL ret;
150  int i;
151 
152  const struct
153  {
154  PCWSTR CabinetFile;
155  PSP_FILE_CALLBACK_W MsgHandler;
156  DWORD expected_lasterror;
157  int todo_lasterror;
158  } invalid_parameters[] =
159  {
160  {nonexistentW, NULL, ERROR_FILE_NOT_FOUND},
161  {nonexistentW, dummy_callbackW, ERROR_FILE_NOT_FOUND},
164  };
165 
168  {
169  win_skip("SetupIterateCabinetW is not available\n");
170  return;
171  }
172 
175 
177 
178  for (i = 0; i < ARRAY_SIZE(invalid_parameters); i++)
179  {
180  SetLastError(0xdeadbeef);
181  ret = SetupIterateCabinetW(invalid_parameters[i].CabinetFile, 0,
182  invalid_parameters[i].MsgHandler, NULL);
183  ok(!ret, "[%d] Expected SetupIterateCabinetW to return 0, got %d\n", i, ret);
184  todo_wine_if (invalid_parameters[i].todo_lasterror)
185  ok(GetLastError() == invalid_parameters[i].expected_lasterror,
186  "[%d] Expected GetLastError() to return %u, got %u\n",
187  i, invalid_parameters[i].expected_lasterror, GetLastError());
188  }
189 
190  SetLastError(0xdeadbeef);
192  ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
194  GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Vista/Win2k8 */
195  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
196  GetLastError());
197 
198  SetLastError(0xdeadbeef);
200  ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
202  GetLastError() == ERROR_NOT_ENOUGH_MEMORY, /* Vista/Win2k8 */
203  "Expected GetLastError() to return ERROR_INVALID_PARAMETER, got %u\n",
204  GetLastError());
205 
206  SetLastError(0xdeadbeef);
208  ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
210  GetLastError() == ERROR_FILE_NOT_FOUND, /* NT4/Win2k */
211  "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
212  GetLastError());
213 
214  SetLastError(0xdeadbeef);
216  ok(!ret, "Expected SetupIterateCabinetW to return 0, got %d\n", ret);
218  GetLastError() == ERROR_FILE_NOT_FOUND, /* NT4/Win2k */
219  "Expected GetLastError() to return ERROR_NOT_ENOUGH_MEMORY, got %u\n",
220  GetLastError());
221 
223 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context)
Definition: setupcab.c:575
static void create_source_fileW(LPWSTR filename, const BYTE *data, DWORD size)
Definition: setupcab.c:58
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define todo_wine_if(is_todo)
Definition: test.h:155
__wchar_t WCHAR
Definition: xmlstorage.h:180
UINT(CALLBACK * PSP_FILE_CALLBACK_W)(IN PVOID Context, IN UINT Notification, IN UINT_PTR Param1, IN UINT_PTR Param2)
Definition: fileqsup.h:66
#define MAX_PATH
Definition: compat.h:26
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
int ret
#define ERROR_INVALID_DATA
Definition: winerror.h:116
static const WCHAR emptyW[]
Definition: navigate.c:40
static calc_node_t temp
Definition: rpn_ieee.c:38
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
static UINT CALLBACK dummy_callbackW(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: setupcab.c:77
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static const WCHAR docW[]
Definition: setupcab.c:45
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

◆ test_simple_enumerationA()

static void test_simple_enumerationA ( void  )
static

Definition at line 374 of file setupcab.c.

375 {
376  BOOL ret;
377  char source[MAX_PATH], temp[MAX_PATH];
378  char target[MAX_PATH];
379  struct contextA ctx;
380 
381  GetTempPathA(sizeof(temp), temp);
382  GetTempFileNameA(temp, "doc", 0, source);
383  GetTempFileNameA(temp, "doc", 0, target);
384 
386 
387  ctx.count = 0;
388  ctx.cabinet = source;
389  ctx.target = target;
391  ok(ret == 1, "Expected SetupIterateCabinetA to return 1, got %d\n", ret);
392  ok(ctx.count == ARRAY_SIZE(expected_files), "Unexpectedly enumerated %d files\n", ctx.count);
393 
396 }
BOOL WINAPI SetupIterateCabinetA(PCSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_A MsgHandler, PVOID Context)
Definition: setupcab.c:510
static const BYTE comp_cab_zip_multi[]
Definition: setupcab.c:32
static const char * expected_files[]
Definition: setupcab.c:300
unsigned int BOOL
Definition: ntddk_ex.h:94
static UINT CALLBACK simple_callbackA(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: setupcab.c:309
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define MAX_PATH
Definition: compat.h:26
int ret
DWORD WINAPI GetTempPathA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2053
static calc_node_t temp
Definition: rpn_ieee.c:38
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
static void create_source_fileA(LPSTR filename, const BYTE *data, DWORD size)
Definition: setupcab.c:47
GLenum target
Definition: glext.h:7315
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26

Referenced by START_TEST().

◆ test_simple_enumerationW()

static void test_simple_enumerationW ( void  )
static

Definition at line 476 of file setupcab.c.

477 {
478  BOOL ret;
481  struct contextW ctx;
482 
485  {
486  win_skip("SetupIterateCabinetW is not available\n");
487  return;
488  }
489 
493 
495 
496  ctx.count = 0;
497  ctx.cabinet = source;
498  ctx.target = target;
500  ok(ret == 1, "Expected SetupIterateCabinetW to return 1, got %d\n", ret);
501  ok(ctx.count == ARRAY_SIZE(expected_files), "Unexpectedly enumerated %d files\n", ctx.count);
502 
505 }
static const BYTE comp_cab_zip_multi[]
Definition: setupcab.c:32
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SetupIterateCabinetW(PCWSTR CabinetFile, DWORD Reserved, PSP_FILE_CALLBACK_W MsgHandler, PVOID Context)
Definition: setupcab.c:575
static const char * expected_files[]
Definition: setupcab.c:300
static void create_source_fileW(LPWSTR filename, const BYTE *data, DWORD size)
Definition: setupcab.c:58
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
int ret
static UINT CALLBACK simple_callbackW(PVOID Context, UINT Notification, UINT_PTR Param1, UINT_PTR Param2)
Definition: setupcab.c:410
static calc_node_t temp
Definition: rpn_ieee.c:38
GLsizei GLsizei GLchar * source
Definition: glext.h:6048
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
GLenum target
Definition: glext.h:7315
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static const WCHAR docW[]
Definition: setupcab.c:45
#define win_skip
Definition: test.h:141

Referenced by START_TEST().

Variable Documentation

◆ comp_cab_zip_multi

const BYTE comp_cab_zip_multi[]
static
Initial value:
= {
0x4d, 0x53, 0x43, 0x46, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x71, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x38, 0xf0, 0x48, 0x20, 0x00, 0x74, 0x72, 0x69, 0x73,
0x74, 0x72, 0x61, 0x6d, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1,
0x38, 0xf0, 0x48, 0x20, 0x00, 0x77, 0x69, 0x6e, 0x65, 0x00, 0x08, 0x00, 0x00, 0x00, 0x18, 0x00,
0x00, 0x00, 0x00, 0x00, 0xd1, 0x38, 0xf0, 0x48, 0x20, 0x00, 0x73, 0x68, 0x61, 0x6e, 0x64, 0x79,
0x00, 0x67, 0x2c, 0x03, 0x85, 0x23, 0x00, 0x20, 0x00, 0x43, 0x4b, 0xcb, 0x49, 0x2c, 0x2d, 0x4a,
0xcd, 0x4b, 0x4e, 0xe5, 0xe5, 0x2a, 0xcd, 0x4b, 0xce, 0xcf, 0x2d, 0x28, 0x4a, 0x2d, 0x2e, 0x4e,
0x4d, 0xe1, 0xe5, 0x2a, 0x2e, 0x49, 0x2d, 0xca, 0x03, 0x8a, 0x02, 0x00
}

Definition at line 32 of file setupcab.c.

Referenced by test_invalid_callbackA(), test_invalid_callbackW(), test_simple_enumerationA(), and test_simple_enumerationW().

◆ docW

const WCHAR docW[] = {'d','o','c',0}
static

◆ expected_files

const char* expected_files[] = {"tristram", "wine", "shandy"}
static

◆ expected_filesW

const WCHAR* expected_filesW[] = {tristramW, wineW, shandyW}
static

Definition at line 401 of file setupcab.c.

Referenced by simple_callbackW().

◆ section_names

struct contextA section_names[]

◆ shandyW

const WCHAR shandyW[] = {'s','h','a','n','d','y',0}
static

Definition at line 400 of file setupcab.c.

◆ tristramW

const WCHAR tristramW[] = {'t','r','i','s','t','r','a','m',0}
static

Definition at line 398 of file setupcab.c.

◆ wineW

const WCHAR wineW[] = {'w','i','n','e',0}
static

Definition at line 399 of file setupcab.c.