ReactOS  0.4.13-dev-249-gcba1a2f
fdi.c File Reference
#include <stdio.h>
#include <windows.h>
#include "fci.h"
#include "fdi.h"
#include "wine/test.h"
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for fdi.c:

Go to the source code of this file.

Classes

struct  CFHEADER
 
struct  CFFOLDER
 
struct  CFFILE
 
struct  CFDATA
 
struct  mem_data
 

Macros

#define MEDIA_SIZE   999999999
 
#define FOLDER_THRESHOLD   900000
 
#define _O_BINARY   0x8000
 
#define _S_IREAD   0x0100
 
#define _S_IWRITE   0x0080
 

Functions

static void *CDECL fdi_alloc (ULONG cb)
 
static void *CDECL fdi_alloc_bad (ULONG cb)
 
static void CDECL fdi_free (void *pv)
 
static INT_PTR CDECL fdi_open (char *pszFile, int oflag, int pmode)
 
static UINT CDECL fdi_read (INT_PTR hf, void *pv, UINT cb)
 
static UINT CDECL fdi_write (INT_PTR hf, void *pv, UINT cb)
 
static int CDECL fdi_close (INT_PTR hf)
 
static LONG CDECL fdi_seek (INT_PTR hf, LONG dist, int seektype)
 
static INT_PTR CDECL fdi_open_static (char *pszFile, int oflag, int pmode)
 
static UINT CDECL fdi_read_static (INT_PTR hf, void *pv, UINT cb)
 
static UINT CDECL fdi_write_static (INT_PTR hf, void *pv, UINT cb)
 
static int CDECL fdi_close_static (INT_PTR hf)
 
static LONG CDECL fdi_seek_static (INT_PTR hf, LONG dist, int seektype)
 
static void test_FDICreate (void)
 
static void test_FDIDestroy (void)
 
static void createTestFile (const CHAR *name)
 
static void create_test_files (void)
 
static void delete_test_files (void)
 
static void *CDECL mem_alloc (ULONG cb)
 
static void CDECL mem_free (void *memory)
 
static BOOL CDECL get_next_cabinet (PCCAB pccab, ULONG cbPrevCab, void *pv)
 
static LONG CDECL progress (UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
 
static int CDECL file_placed (PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
 
static INT_PTR CDECL fci_open (char *pszFile, int oflag, int pmode, int *err, void *pv)
 
static UINT CDECL fci_read (INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
 
static UINT CDECL fci_write (INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
 
static int CDECL fci_close (INT_PTR hf, int *err, void *pv)
 
static LONG CDECL fci_seek (INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
 
static int CDECL fci_delete (char *pszFile, int *err, void *pv)
 
static BOOL CDECL get_temp_file (char *pszTempName, int cbTempName, void *pv)
 
static INT_PTR CDECL get_open_info (char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
 
static void add_file (HFCI hfci, char *file)
 
static void set_cab_parameters (PCCAB pCabParams)
 
static void create_cab_file (void)
 
static void test_FDIIsCabinet (void)
 
static INT_PTR __cdecl CopyProgress (FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
 
static INT_PTR CDECL fdi_mem_open (char *name, int oflag, int pmode)
 
static UINT CDECL fdi_mem_read (INT_PTR hf, void *pv, UINT cb)
 
static UINT CDECL fdi_mem_write (INT_PTR hf, void *pv, UINT cb)
 
static int CDECL fdi_mem_close (INT_PTR hf)
 
static LONG CDECL fdi_mem_seek (INT_PTR hf, LONG dist, int seektype)
 
static INT_PTR CDECL fdi_mem_notify (FDINOTIFICATIONTYPE fdint, FDINOTIFICATION *info)
 
static void test_FDICopy (void)
 
 START_TEST (fdi)
 

Variables

static CHAR CURR_DIR [MAX_PATH]
 
struct {
   struct CFHEADER   header
 
   struct CFFOLDER   folder
 
   struct CFFILE   file
 
   UCHAR   szName [sizeof("file.dat")]
 
   struct CFDATA   data
 
   UCHAR   ab [sizeof("Hello World!") -1]
 
cab_data
 
static INT_PTR static_fdi_handle
 

Macro Definition Documentation

◆ _O_BINARY

#define _O_BINARY   0x8000

Definition at line 36 of file fdi.c.

◆ _S_IREAD

#define _S_IREAD   0x0100

Definition at line 40 of file fdi.c.

◆ _S_IWRITE

#define _S_IWRITE   0x0080

Definition at line 41 of file fdi.c.

◆ FOLDER_THRESHOLD

#define FOLDER_THRESHOLD   900000

Definition at line 30 of file fdi.c.

◆ MEDIA_SIZE

#define MEDIA_SIZE   999999999

Definition at line 29 of file fdi.c.

Function Documentation

◆ add_file()

static void add_file ( HFCI  hfci,
char file 
)
static

Definition at line 596 of file fdi.c.

597 {
598  char path[MAX_PATH];
599  BOOL res;
600 
602  lstrcatA(path, "\\");
603  lstrcatA(path, file);
604 
607  ok(res, "Expected FCIAddFile to succeed\n");
608 }
static CHAR CURR_DIR[MAX_PATH]
Definition: fdi.c:32
#define tcompTYPE_MSZIP
Definition: fci.h:65
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: fdi.c:457
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:26
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: fdi.c:462
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
Definition: services.c:325
BOOL __cdecl FCIAddFile(HFCI hfci, char *pszSourceFile, char *pszFileName, BOOL fExecute, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis, PFNFCIGETOPENINFO pfnfcigoi, TCOMP typeCompress)
Definition: fci.c:1397
GLuint res
Definition: glext.h:9613
static INT_PTR CDECL get_open_info(char *pszName, USHORT *pdate, USHORT *ptime, USHORT *pattribs, int *err, void *pv)
Definition: fdi.c:567
Definition: fci.c:126

Referenced by create_cab_file().

◆ CopyProgress()

static INT_PTR __cdecl CopyProgress ( FDINOTIFICATIONTYPE  fdint,
PFDINOTIFICATION  pfdin 
)
static

Definition at line 745 of file fdi.c.

746 {
747  return 37; /* doc says 0, but anything != -1 apparently means success as well */
748 }

Referenced by test_FDICopy().

◆ create_cab_file()

static void create_cab_file ( void  )
static

Definition at line 622 of file fdi.c.

623 {
624  CCAB cabParams;
625  HFCI hfci;
626  ERF erf;
627  static CHAR a_txt[] = "a.txt",
628  b_txt[] = "b.txt",
629  testdir_c_txt[] = "testdir\\c.txt",
630  testdir_d_txt[] = "testdir\\d.txt";
631  BOOL res;
632 
633  set_cab_parameters(&cabParams);
634 
637  get_temp_file, &cabParams, NULL);
638 
639  ok(hfci != NULL, "Failed to create an FCI context\n");
640 
641  add_file(hfci, a_txt);
642  add_file(hfci, b_txt);
643  add_file(hfci, testdir_c_txt);
644  add_file(hfci, testdir_d_txt);
645 
647  ok(res, "Failed to flush the cabinet\n");
648 
649  res = FCIDestroy(hfci);
650  ok(res, "Failed to destroy the cabinet\n");
651 }
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: fdi.c:548
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1675
HFCI __cdecl FCICreate(PERF perf, PFNFCIFILEPLACED pfnfiledest, PFNFCIALLOC pfnalloc, PFNFCIFREE pfnfree, PFNFCIOPEN pfnopen, PFNFCIREAD pfnread, PFNFCIWRITE pfnwrite, PFNFCICLOSE pfnclose, PFNFCISEEK pfnseek, PFNFCIDELETE pfndelete, PFNFCIGETTEMPFILE pfnfcigtf, PCCAB pccab, void *pv)
Definition: fci.c:998
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fdi.c:497
char CHAR
Definition: xmlstorage.h:175
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1709
static void add_file(HFCI hfci, char *file)
Definition: fdi.c:596
Definition: fci.h:144
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: fdi.c:540
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: fci.h:44
#define ok(value,...)
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fdi.c:509
smooth NULL
Definition: ftsmooth.c:416
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: fdi.c:457
double __cdecl erf(double)
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: fdi.c:462
static void *CDECL mem_alloc(ULONG cb)
Definition: fdi.c:447
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: fdi.c:529
static void CDECL mem_free(void *memory)
Definition: fdi.c:452
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: fdi.c:467
GLuint res
Definition: glext.h:9613
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: fdi.c:473
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: fdi.c:521
static void set_cab_parameters(PCCAB pCabParams)
Definition: fdi.c:610

Referenced by test_FDIIsCabinet().

◆ create_test_files()

static void create_test_files ( void  )
static

Definition at line 418 of file fdi.c.

419 {
420  DWORD len;
421 
423 
424  if(len && (CURR_DIR[len-1] == '\\'))
425  CURR_DIR[len-1] = 0;
426 
427  createTestFile("a.txt");
428  createTestFile("b.txt");
429  CreateDirectoryA("testdir", NULL);
430  createTestFile("testdir\\c.txt");
431  createTestFile("testdir\\d.txt");
432 }
static CHAR CURR_DIR[MAX_PATH]
Definition: fdi.c:32
BOOL WINAPI CreateDirectoryA(IN LPCSTR lpPathName, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes)
Definition: dir.c:37
smooth NULL
Definition: ftsmooth.c:416
static void createTestFile(const CHAR *name)
Definition: fdi.c:406
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145

Referenced by test_FDIIsCabinet().

◆ createTestFile()

static void createTestFile ( const CHAR name)
static

Definition at line 406 of file fdi.c.

407 {
408  HANDLE file;
409  DWORD written;
410 
412  ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
413  WriteFile(file, name, strlen(name), &written, NULL);
414  WriteFile(file, "\n", strlen("\n"), &written, NULL);
415  CloseHandle(file);
416 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:398
struct CFFILE file
Definition: fdi.c:111
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define GENERIC_WRITE
Definition: nt_native.h:90
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CREATE_ALWAYS
Definition: disk.h:72
Definition: name.c:36
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399
Definition: fci.c:126

Referenced by create_test_files(), and test_FDIIsCabinet().

◆ delete_test_files()

static void delete_test_files ( void  )
static

Definition at line 434 of file fdi.c.

435 {
436  DeleteFileA("a.txt");
437  DeleteFileA("b.txt");
438  DeleteFileA("testdir\\c.txt");
439  DeleteFileA("testdir\\d.txt");
440  RemoveDirectoryA("testdir");
441 
442  DeleteFileA("extract.cab");
443 }
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
BOOL WINAPI RemoveDirectoryA(IN LPCSTR lpPathName)
Definition: dir.c:714

Referenced by test_FDIIsCabinet().

◆ fci_close()

static int CDECL fci_close ( INT_PTR  hf,
int err,
void pv 
)
static

Definition at line 521 of file fdi.c.

522 {
523  HANDLE handle = (HANDLE)hf;
524  ok(CloseHandle(handle), "Failed to CloseHandle\n");
525 
526  return 0;
527 }
#define CloseHandle
Definition: compat.h:398
#define ok(value,...)
PVOID HANDLE
Definition: typedefs.h:71

Referenced by create_cab_file(), and test_FDICopy().

◆ fci_delete()

static int CDECL fci_delete ( char pszFile,
int err,
void pv 
)
static

Definition at line 540 of file fdi.c.

541 {
542  BOOL ret = DeleteFileA(pszFile);
543  ok(ret, "Failed to DeleteFile %s\n", pszFile);
544 
545  return 0;
546 }
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
int ret

Referenced by create_cab_file(), and test_FDICopy().

◆ fci_open()

static INT_PTR CDECL fci_open ( char pszFile,
int  oflag,
int  pmode,
int err,
void pv 
)
static

Definition at line 473 of file fdi.c.

474 {
475  HANDLE handle;
476  DWORD dwAccess = 0;
477  DWORD dwShareMode = 0;
478  DWORD dwCreateDisposition = OPEN_EXISTING;
479 
480  dwAccess = GENERIC_READ | GENERIC_WRITE;
481  /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
482  dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
483 
485  dwCreateDisposition = OPEN_EXISTING;
486  else
487  dwCreateDisposition = CREATE_NEW;
488 
489  handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
490  dwCreateDisposition, 0, NULL);
491 
492  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
493 
494  return (INT_PTR)handle;
495 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT_PTR
Definition: typedefs.h:62
#define FILE_SHARE_READ
Definition: compat.h:125
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#define GENERIC_WRITE
Definition: nt_native.h:90
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define GENERIC_READ
Definition: compat.h:124
#define CREATE_NEW
Definition: disk.h:69
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by create_cab_file(), and test_FDICopy().

◆ fci_read()

static UINT CDECL fci_read ( INT_PTR  hf,
void memory,
UINT  cb,
int err,
void pv 
)
static

Definition at line 497 of file fdi.c.

498 {
499  HANDLE handle = (HANDLE)hf;
500  DWORD dwRead;
501  BOOL res;
502 
503  res = ReadFile(handle, memory, cb, &dwRead, NULL);
504  ok(res, "Failed to ReadFile\n");
505 
506  return dwRead;
507 }
static char memory[1024 *256]
Definition: process.c:116
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static DWORD cb
Definition: integrity.c:41
GLuint res
Definition: glext.h:9613
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123

Referenced by create_cab_file(), and test_FDICopy().

◆ fci_seek()

static LONG CDECL fci_seek ( INT_PTR  hf,
LONG  dist,
int  seektype,
int err,
void pv 
)
static

Definition at line 529 of file fdi.c.

530 {
531  HANDLE handle = (HANDLE)hf;
532  DWORD ret;
533 
534  ret = SetFilePointer(handle, dist, NULL, seektype);
535  ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
536 
537  return ret;
538 }
#define INVALID_SET_FILE_POINTER
Definition: winbase.h:115
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
int ret

Referenced by create_cab_file(), and test_FDICopy().

◆ fci_write()

static UINT CDECL fci_write ( INT_PTR  hf,
void memory,
UINT  cb,
int err,
void pv 
)
static

Definition at line 509 of file fdi.c.

510 {
511  HANDLE handle = (HANDLE)hf;
512  DWORD dwWritten;
513  BOOL res;
514 
515  res = WriteFile(handle, memory, cb, &dwWritten, NULL);
516  ok(res, "Failed to WriteFile\n");
517 
518  return dwWritten;
519 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static char memory[1024 *256]
Definition: process.c:116
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static DWORD cb
Definition: integrity.c:41
GLuint res
Definition: glext.h:9613

Referenced by create_cab_file(), and test_FDICopy().

◆ fdi_alloc()

static void* CDECL fdi_alloc ( ULONG  cb)
static

Definition at line 135 of file fdi.c.

136 {
137  return HeapAlloc(GetProcessHeap(), 0, cb);
138 }
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static DWORD cb
Definition: integrity.c:41

Referenced by test_FDICopy(), test_FDICreate(), test_FDIDestroy(), and test_FDIIsCabinet().

◆ fdi_alloc_bad()

static void* CDECL fdi_alloc_bad ( ULONG  cb)
static

Definition at line 140 of file fdi.c.

141 {
142  return NULL;
143 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by test_FDICreate().

◆ fdi_close()

static int CDECL fdi_close ( INT_PTR  hf)
static

Definition at line 178 of file fdi.c.

179 {
180  HANDLE handle = (HANDLE) hf;
181  return CloseHandle(handle) ? 0 : -1;
182 }
#define CloseHandle
Definition: compat.h:398
PVOID HANDLE
Definition: typedefs.h:71

Referenced by test_FDICopy(), test_FDICreate(), test_FDIDestroy(), and test_FDIIsCabinet().

◆ fdi_close_static()

static int CDECL fdi_close_static ( INT_PTR  hf)
static

Definition at line 211 of file fdi.c.

212 {
213  ok(0, "FDIIsCabinet shouldn't call pfnclose\n");
214  return 0;
215 }
#define ok(value,...)

Referenced by test_FDIIsCabinet().

◆ fdi_free()

static void CDECL fdi_free ( void pv)
static

Definition at line 145 of file fdi.c.

146 {
147  HeapFree(GetProcessHeap(), 0, pv);
148 }
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_FDICopy(), test_FDICreate(), test_FDIDestroy(), and test_FDIIsCabinet().

◆ fdi_mem_close()

static int CDECL fdi_mem_close ( INT_PTR  hf)
static

Definition at line 798 of file fdi.c.

799 {
800  HeapFree(GetProcessHeap(), 0, (void *)hf);
801  return 0;
802 }
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_FDICopy().

◆ fdi_mem_notify()

static INT_PTR CDECL fdi_mem_notify ( FDINOTIFICATIONTYPE  fdint,
FDINOTIFICATION info 
)
static

Definition at line 831 of file fdi.c.

832 {
833  static const char expected[9] = "file.dat\0";
834 
835  switch (fdint)
836  {
838  trace("mem_notify: CLOSE_FILE_INFO %s, handle %#lx\n", info->psz1, info->hf);
839 
840  ok(!strcmp(info->psz1, expected), "expected %s, got %s\n", expected, info->psz1);
841  ok(info->date == 0x1225, "expected 0x1225, got %#x\n", info->date);
842  ok(info->time == 0x2013, "expected 0x2013, got %#x\n", info->time);
843  ok(info->attribs == 0xa114, "expected 0xa114, got %#x\n", info->attribs);
844  ok(info->iFolder == 0x1234, "expected 0x1234, got %#x\n", info->iFolder);
845  return 1;
846 
847  case fdintCOPY_FILE:
848  {
849  trace("mem_notify: COPY_FILE %s, %d bytes\n", info->psz1, info->cb);
850 
851  ok(info->cb == 12, "expected 12, got %u\n", info->cb);
852  ok(!strcmp(info->psz1, expected), "expected %s, got %s\n", expected, info->psz1);
853  ok(info->iFolder == 0x1234, "expected 0x1234, got %#x\n", info->iFolder);
854  return 0x12345678; /* call write() callback */
855  }
856 
857  default:
858  trace("mem_notify(%d,%p)\n", fdint, info);
859  return 0;
860  }
861 
862  return 0;
863 }
#define trace(...)
Definition: kmt_test.h:217
#define ok(value,...)
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
BOOL expected
Definition: store.c:2063

Referenced by test_FDICopy().

◆ fdi_mem_open()

static INT_PTR CDECL fdi_mem_open ( char name,
int  oflag,
int  pmode 
)
static

Definition at line 750 of file fdi.c.

751 {
752  static const char expected[] = "memory\\block";
753  struct mem_data *data;
754 
755  ok(!strcmp(name, expected), "expected %s, got %s\n", expected, name);
756  ok(oflag == _O_BINARY, "expected _O_BINARY, got %x\n", oflag);
757  ok(pmode == (_S_IREAD | _S_IWRITE), "expected _S_IREAD | _S_IWRITE, got %x\n", pmode);
758 
759  data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data));
760  if (!data) return -1;
761 
762  data->base = (const char *)&cab_data;
763  data->size = sizeof(cab_data);
764  data->pos = 0;
765 
766  trace("mem_open(%s,%x,%x) => %p\n", name, oflag, pmode, data);
767  return (INT_PTR)data;
768 }
#define trace(...)
Definition: kmt_test.h:217
#define _S_IWRITE
Definition: fdi.c:41
int32_t INT_PTR
Definition: typedefs.h:62
struct CFDATA data
Definition: fdi.c:113
#define ok(value,...)
static const struct @1576 cab_data
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: fdi.c:127
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define _S_IREAD
Definition: fdi.c:40
Definition: name.c:36
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define _O_BINARY
Definition: fdi.c:36
BOOL expected
Definition: store.c:2063

Referenced by test_FDICopy().

◆ fdi_mem_read()

static UINT CDECL fdi_mem_read ( INT_PTR  hf,
void pv,
UINT  cb 
)
static

Definition at line 770 of file fdi.c.

771 {
772  struct mem_data *data = (struct mem_data *)hf;
773  UINT available, cb_read;
774 
775  available = data->size - data->pos;
776  cb_read = (available >= cb) ? cb : available;
777 
778  memcpy(pv, data->base + data->pos, cb_read);
779  data->pos += cb_read;
780 
781  /*trace("mem_read(%p,%p,%u) => %u\n", hf, pv, cb, cb_read);*/
782  return cb_read;
783 }
static WCHAR available[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2336
Definition: fdi.c:127
static DWORD cb
Definition: integrity.c:41
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int UINT
Definition: ndis.h:50

Referenced by test_FDICopy().

◆ fdi_mem_seek()

static LONG CDECL fdi_mem_seek ( INT_PTR  hf,
LONG  dist,
int  seektype 
)
static

Definition at line 804 of file fdi.c.

805 {
806  struct mem_data *data = (struct mem_data *)hf;
807 
808  switch (seektype)
809  {
810  case SEEK_SET:
811  data->pos = dist;
812  break;
813 
814  case SEEK_CUR:
815  data->pos += dist;
816  break;
817 
818  case SEEK_END:
819  default:
820  ok(0, "seek: not expected type %d\n", seektype);
821  return -1;
822  }
823 
824  if (data->pos < 0) data->pos = 0;
825  if (data->pos > data->size) data->pos = data->size;
826 
827  /*mem_seek(%p,%d,%d) => %u\n", hf, dist, seektype, data->pos);*/
828  return data->pos;
829 }
#define SEEK_CUR
Definition: util.h:63
#define ok(value,...)
#define SEEK_SET
Definition: jmemansi.c:26
Definition: fdi.c:127
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define SEEK_END
Definition: cabinet.c:27

Referenced by test_FDICopy().

◆ fdi_mem_write()

static UINT CDECL fdi_mem_write ( INT_PTR  hf,
void pv,
UINT  cb 
)
static

Definition at line 785 of file fdi.c.

786 {
787  static const char expected[12] = "Hello World!";
788 
789  trace("mem_write(%#lx,%p,%u)\n", hf, pv, cb);
790 
791  ok(hf == 0x12345678, "expected 0x12345678, got %#lx\n", hf);
792  ok(cb == 12, "expected 12, got %u\n", cb);
793  ok(!memcmp(pv, expected, 12), "expected %s, got %s\n", expected, (const char *)pv);
794 
795  return cb;
796 }
#define trace(...)
Definition: kmt_test.h:217
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ok(value,...)
static DWORD cb
Definition: integrity.c:41
BOOL expected
Definition: store.c:2063

Referenced by test_FDICopy().

◆ fdi_open()

static INT_PTR CDECL fdi_open ( char pszFile,
int  oflag,
int  pmode 
)
static

Definition at line 150 of file fdi.c.

151 {
152  HANDLE handle;
154  OPEN_EXISTING, 0, NULL );
156  return 0;
157  return (INT_PTR) handle;
158 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
int32_t INT_PTR
Definition: typedefs.h:62
#define FILE_SHARE_READ
Definition: compat.h:125
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
#define GENERIC_READ
Definition: compat.h:124
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by test_FDICopy(), test_FDICreate(), test_FDIDestroy(), and test_FDIIsCabinet().

◆ fdi_open_static()

static INT_PTR CDECL fdi_open_static ( char pszFile,
int  oflag,
int  pmode 
)
static

Definition at line 193 of file fdi.c.

194 {
195  ok(0, "FDIIsCabinet shouldn't call pfnopen\n");
196  return 1;
197 }
#define ok(value,...)

Referenced by test_FDIIsCabinet().

◆ fdi_read()

static UINT CDECL fdi_read ( INT_PTR  hf,
void pv,
UINT  cb 
)
static

Definition at line 160 of file fdi.c.

161 {
162  HANDLE handle = (HANDLE) hf;
163  DWORD dwRead;
164  if (ReadFile(handle, pv, cb, &dwRead, NULL))
165  return dwRead;
166  return 0;
167 }
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static DWORD cb
Definition: integrity.c:41
BOOL WINAPI ReadFile(IN HANDLE hFile, IN LPVOID lpBuffer, IN DWORD nNumberOfBytesToRead, OUT LPDWORD lpNumberOfBytesRead OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:123

Referenced by fdi_read_static(), test_FDICopy(), test_FDICreate(), test_FDIDestroy(), and test_FDIIsCabinet().

◆ fdi_read_static()

static UINT CDECL fdi_read_static ( INT_PTR  hf,
void pv,
UINT  cb 
)
static

Definition at line 199 of file fdi.c.

200 {
201  ok(hf == 0, "unexpected hf %lx\n", hf);
202  return fdi_read(static_fdi_handle, pv, cb);
203 }
#define ok(value,...)
static DWORD cb
Definition: integrity.c:41
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:160
static INT_PTR static_fdi_handle
Definition: fdi.c:191

Referenced by test_FDIIsCabinet().

◆ fdi_seek()

static LONG CDECL fdi_seek ( INT_PTR  hf,
LONG  dist,
int  seektype 
)
static

Definition at line 184 of file fdi.c.

185 {
186  HANDLE handle = (HANDLE) hf;
187  return SetFilePointer(handle, dist, NULL, seektype);
188 }
DWORD WINAPI DECLSPEC_HOTPATCH SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
Definition: fileinfo.c:204
smooth NULL
Definition: ftsmooth.c:416
PVOID HANDLE
Definition: typedefs.h:71

Referenced by fdi_seek_static(), test_FDICopy(), test_FDICreate(), test_FDIDestroy(), and test_FDIIsCabinet().

◆ fdi_seek_static()

static LONG CDECL fdi_seek_static ( INT_PTR  hf,
LONG  dist,
int  seektype 
)
static

Definition at line 217 of file fdi.c.

218 {
219  ok(hf == 0, "unexpected hf %lx\n", hf);
220  return fdi_seek(static_fdi_handle, dist, seektype);
221 }
#define ok(value,...)
static INT_PTR static_fdi_handle
Definition: fdi.c:191
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:184

Referenced by test_FDIIsCabinet().

◆ fdi_write()

static UINT CDECL fdi_write ( INT_PTR  hf,
void pv,
UINT  cb 
)
static

Definition at line 169 of file fdi.c.

170 {
171  HANDLE handle = (HANDLE) hf;
172  DWORD dwWritten;
173  if (WriteFile(handle, pv, cb, &dwWritten, NULL))
174  return dwWritten;
175  return 0;
176 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static DWORD cb
Definition: integrity.c:41

Referenced by test_FDICopy(), test_FDICreate(), test_FDIDestroy(), and test_FDIIsCabinet().

◆ fdi_write_static()

static UINT CDECL fdi_write_static ( INT_PTR  hf,
void pv,
UINT  cb 
)
static

Definition at line 205 of file fdi.c.

206 {
207  ok(0, "FDIIsCabinet shouldn't call pfnwrite\n");
208  return 0;
209 }
#define ok(value,...)

Referenced by test_FDIIsCabinet().

◆ file_placed()

static int CDECL file_placed ( PCCAB  pccab,
char pszFile,
LONG  cbFile,
BOOL  fContinuation,
void pv 
)
static

Definition at line 467 of file fdi.c.

469 {
470  return 0;
471 }

Referenced by create_cab_file(), and test_FDICopy().

◆ get_next_cabinet()

static BOOL CDECL get_next_cabinet ( PCCAB  pccab,
ULONG  cbPrevCab,
void pv 
)
static

Definition at line 457 of file fdi.c.

458 {
459  return TRUE;
460 }
#define TRUE
Definition: types.h:120

Referenced by add_file(), create_cab_file(), and test_FDICopy().

◆ get_open_info()

static INT_PTR CDECL get_open_info ( char pszName,
USHORT pdate,
USHORT ptime,
USHORT pattribs,
int err,
void pv 
)
static

Definition at line 567 of file fdi.c.

569 {
572  HANDLE handle;
573  DWORD attrs;
574  BOOL res;
575 
578 
579  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
580 
582  ok(res, "Expected GetFileInformationByHandle to succeed\n");
583 
585  FileTimeToDosDateTime(&filetime, pdate, ptime);
586 
587  attrs = GetFileAttributesA(pszName);
588  ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
589  /* fixme: should convert attrs to *pattribs, make sure
590  * have a test that catches the fact that we don't?
591  */
592 
593  return (INT_PTR)handle;
594 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
int32_t INT_PTR
Definition: typedefs.h:62
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:211
#define FILE_SHARE_READ
Definition: compat.h:125
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
Definition: fileinfo.c:786
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:426
BOOL WINAPI GetFileInformationByHandle(HANDLE hFile, LPBY_HANDLE_FILE_INFORMATION lpFileInformation)
Definition: fileinfo.c:608
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define GENERIC_READ
Definition: compat.h:124
BOOL WINAPI FileTimeToDosDateTime(IN CONST FILETIME *lpFileTime, OUT LPWORD lpFatDate, OUT LPWORD lpFatTime)
Definition: time.c:37
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
GLuint res
Definition: glext.h:9613
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:399

Referenced by add_file().

◆ get_temp_file()

static BOOL CDECL get_temp_file ( char pszTempName,
int  cbTempName,
void pv 
)
static

Definition at line 548 of file fdi.c.

549 {
550  LPSTR tempname;
551 
552  tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
553  GetTempFileNameA(".", "xx", 0, tempname);
554 
555  if (tempname && (strlen(tempname) < (unsigned)cbTempName))
556  {
557  lstrcpyA(pszTempName, tempname);
558  HeapFree(GetProcessHeap(), 0, tempname);
559  return TRUE;
560  }
561 
562  HeapFree(GetProcessHeap(), 0, tempname);
563 
564  return FALSE;
565 }
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * LPSTR
Definition: xmlstorage.h:182
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define MAX_PATH
Definition: compat.h:26
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
UINT WINAPI GetTempFileNameA(IN LPCSTR lpPathName, IN LPCSTR lpPrefixString, IN UINT uUnique, OUT LPSTR lpTempFileName)
Definition: filename.c:26
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by create_cab_file(), and test_FDICopy().

◆ mem_alloc()

static void* CDECL mem_alloc ( ULONG  cb)
static

Definition at line 447 of file fdi.c.

448 {
449  return HeapAlloc(GetProcessHeap(), 0, cb);
450 }
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static DWORD cb
Definition: integrity.c:41

Referenced by create_cab_file(), and test_FDICopy().

◆ mem_free()

static void CDECL mem_free ( void memory)
static

Definition at line 452 of file fdi.c.

453 {
455 }
static char memory[1024 *256]
Definition: process.c:116
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by create_cab_file(), and test_FDICopy().

◆ progress()

static LONG CDECL progress ( UINT  typeStatus,
ULONG  cb1,
ULONG  cb2,
void pv 
)
static

Definition at line 462 of file fdi.c.

463 {
464  return 0;
465 }

Referenced by add_file(), create_cab_file(), and test_FDICopy().

◆ set_cab_parameters()

static void set_cab_parameters ( PCCAB  pCabParams)
static

Definition at line 610 of file fdi.c.

611 {
612  ZeroMemory(pCabParams, sizeof(CCAB));
613 
614  pCabParams->cb = MEDIA_SIZE;
615  pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
616  pCabParams->setID = 0xbeef;
617  lstrcpyA(pCabParams->szCabPath, CURR_DIR);
618  lstrcatA(pCabParams->szCabPath, "\\");
619  lstrcpyA(pCabParams->szCab, "extract.cab");
620 }
ULONG cbFolderThresh
Definition: fci.h:146
static CHAR CURR_DIR[MAX_PATH]
Definition: fdi.c:32
#define ZeroMemory
Definition: winbase.h:1635
Definition: fci.h:144
char szCab[CB_MAX_CABINET_NAME]
Definition: fci.h:160
ULONG cb
Definition: fci.h:145
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MEDIA_SIZE
Definition: fdi.c:29
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define FOLDER_THRESHOLD
Definition: fdi.c:30
USHORT setID
Definition: fci.h:157
char szCabPath[CB_MAX_CAB_PATH]
Definition: fci.h:161

Referenced by create_cab_file(), and test_FDICopy().

◆ START_TEST()

START_TEST ( fdi  )

Definition at line 953 of file fdi.c.

954 {
955  test_FDICreate();
956  test_FDIDestroy();
958  test_FDICopy();
959 }
static void test_FDIIsCabinet(void)
Definition: fdi.c:653
static void test_FDICreate(void)
Definition: fdi.c:223
static void test_FDICopy(void)
Definition: fdi.c:865
static void test_FDIDestroy(void)
Definition: fdi.c:380

◆ test_FDICopy()

static void test_FDICopy ( void  )
static

Definition at line 865 of file fdi.c.

866 {
867  CCAB cabParams;
868  HFDI hfdi;
869  HFCI hfci;
870  ERF erf;
871  BOOL ret;
872  char name[] = "extract.cab";
873  char path[MAX_PATH + 1];
874  char memory_block[] = "memory\\block";
875  char memory[] = "memory\\";
876  char block[] = "block";
878  INT_PTR fd;
879 
880  set_cab_parameters(&cabParams);
881 
884  fci_delete, get_temp_file, &cabParams, NULL);
885 
887  ok(ret, "Failed to flush the cabinet\n");
888 
889  FCIDestroy(hfci);
890 
892 
893  /* path doesn't have a trailing backslash */
894  if (lstrlenA(path) > 2)
895  {
898  cpuUNKNOWN, &erf);
899 
900  SetLastError(0xdeadbeef);
901  ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
902  ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
904  "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
905 
906  FDIDestroy(hfdi);
907  }
908  else
909  skip("Running on a root drive directory.\n");
910 
911  lstrcatA(path, "\\");
912 
915  cpuUNKNOWN, &erf);
916 
917  /* cabinet with no files or folders */
918  SetLastError(0xdeadbeef);
919  ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
920  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
921  ok(GetLastError() == 0, "Expected 0f, got %d\n", GetLastError());
922 
923  FDIDestroy(hfdi);
924 
925  DeleteFileA(name);
926 
927  /* test extracting from a memory block */
930  ok(hfdi != NULL, "FDICreate error %d\n", erf.erfOper);
931 
932  fd = fdi_mem_open(memory_block, _O_BINARY, _S_IREAD | _S_IWRITE);
933  ok(fd != -1, "fdi_open failed\n");
934 
935  memset(&info, 0, sizeof(info));
936  ret = FDIIsCabinet(hfdi, fd, &info);
937  ok(ret, "FDIIsCabinet error %d\n", erf.erfOper);
938  ok(info.cbCabinet == 0x59, "expected 0x59, got %#x\n", info.cbCabinet);
939  ok(info.cFiles == 1, "expected 1, got %d\n", info.cFiles);
940  ok(info.cFolders == 1, "expected 1, got %d\n", info.cFolders);
941  ok(info.setID == 0x1225, "expected 0x1225, got %#x\n", info.setID);
942  ok(info.iCabinet == 0x2013, "expected 0x2013, got %#x\n", info.iCabinet);
943 
944  fdi_mem_close(fd);
945 
946  ret = FDICopy(hfdi, block, memory, 0, fdi_mem_notify, NULL, 0);
947  ok(ret, "FDICopy error %d\n", erf.erfOper);
948 
949  FDIDestroy(hfdi);
950 }
static unsigned int block
Definition: xmlmemory.c:118
BOOL __cdecl FDIDestroy(HFDI hfdi)
Definition: fdi.c:2831
static UINT CDECL fdi_write(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:169
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: fdi.c:548
#define TRUE
Definition: types.h:120
#define _S_IWRITE
Definition: fdi.c:41
BOOL __cdecl FCIFlushCabinet(HFCI hfci, BOOL fGetNextCab, PFNFCIGETNEXTCABINET pfnfcignc, PFNFCISTATUS pfnfcis)
Definition: fci.c:1675
HFCI __cdecl FCICreate(PERF perf, PFNFCIFILEPLACED pfnfiledest, PFNFCIALLOC pfnalloc, PFNFCIFREE pfnfree, PFNFCIOPEN pfnopen, PFNFCIREAD pfnread, PFNFCIWRITE pfnwrite, PFNFCICLOSE pfnclose, PFNFCISEEK pfnseek, PFNFCIDELETE pfndelete, PFNFCIGETTEMPFILE pfnfcigtf, PCCAB pccab, void *pv)
Definition: fci.c:998
static CHAR CURR_DIR[MAX_PATH]
Definition: fdi.c:32
static INT_PTR __cdecl CopyProgress(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
Definition: fdi.c:745
static void CDECL fdi_free(void *pv)
Definition: fdi.c:145
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fdi.c:497
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
Definition: fdi.c:150
static INT_PTR CDECL fdi_mem_notify(FDINOTIFICATIONTYPE fdint, FDINOTIFICATION *info)
Definition: fdi.c:831
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
BOOL __cdecl FCIDestroy(HFCI hfci)
Definition: fci.c:1709
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static int fd
Definition: io.c:51
Definition: fci.h:144
int32_t INT_PTR
Definition: typedefs.h:62
static UINT CDECL fdi_mem_write(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:785
static char memory[1024 *256]
Definition: process.c:116
struct _test_info info[]
Definition: SetCursorPos.c:19
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: fdi.c:540
#define cpuUNKNOWN
Definition: fdi.h:269
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: fci.h:44
BOOL __cdecl FDICopy(HFDI hfdi, char *pszCabinet, char *pszCabPath, int flags, PFNFDINOTIFY pfnfdin, PFNFDIDECRYPT pfnfdid, void *pvUser)
Definition: fdi.c:2431
#define ok(value,...)
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fdi.c:509
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
HFDI __cdecl FDICreate(PFNALLOC pfnalloc, PFNFREE pfnfree, PFNOPEN pfnopen, PFNREAD pfnread, PFNWRITE pfnwrite, PFNCLOSE pfnclose, PFNSEEK pfnseek, int cpuType, PERF perf)
Definition: fdi.c:412
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: fdi.c:457
static int CDECL fdi_mem_close(INT_PTR hf)
Definition: fdi.c:798
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
static UINT CDECL fdi_mem_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:770
static int CDECL fdi_close(INT_PTR hf)
Definition: fdi.c:178
double __cdecl erf(double)
#define MAX_PATH
Definition: compat.h:26
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: fdi.c:462
#define SetLastError(x)
Definition: compat.h:409
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
static INT_PTR CDECL fdi_mem_open(char *name, int oflag, int pmode)
Definition: fdi.c:750
int ret
static LONG CDECL fdi_mem_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:804
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:160
#define _S_IREAD
Definition: fdi.c:40
static void *CDECL mem_alloc(ULONG cb)
Definition: fdi.c:447
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: fdi.c:529
Definition: services.c:325
static void CDECL mem_free(void *memory)
Definition: fdi.c:452
#define skip(...)
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: fdi.c:467
Definition: name.c:36
BOOL __cdecl FDIIsCabinet(HFDI hfdi, INT_PTR hf, PFDICABINETINFO pfdici)
Definition: fdi.c:696
#define _O_BINARY
Definition: fdi.c:36
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: fdi.c:473
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:184
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: fdi.c:521
#define memset(x, y, z)
Definition: compat.h:39
static void set_cab_parameters(PCCAB pCabParams)
Definition: fdi.c:610
static void *CDECL fdi_alloc(ULONG cb)
Definition: fdi.c:135

Referenced by START_TEST().

◆ test_FDICreate()

static void test_FDICreate ( void  )
static

Definition at line 223 of file fdi.c.

224 {
225  HFDI hfdi;
226  ERF erf;
227 
228  /* native crashes if pfnalloc is NULL */
229 
230  /* FDICreate does not crash with a NULL pfnfree,
231  * but FDIDestroy will crash when it tries to access it.
232  */
233  if (0)
234  {
235  SetLastError(0xdeadbeef);
236  erf.erfOper = 0x1abe11ed;
237  erf.erfType = 0x5eed1e55;
238  erf.fError = 0x1ead1e55;
241  cpuUNKNOWN, &erf);
242  ok(hfdi != NULL, "Expected non-NULL context\n");
243  ok(GetLastError() == 0xdeadbeef,
244  "Expected 0xdeadbeef, got %d\n", GetLastError());
245  ok(erf.erfOper == 0x1abe11ed, "Expected 0x1abe11ed, got %d\n", erf.erfOper);
246  ok(erf.erfType == 0x5eed1e55, "Expected 0x5eed1e55, got %d\n", erf.erfType);
247  ok(erf.fError == 0x1ead1e55, "Expected 0x1ead1e55, got %d\n", erf.fError);
248 
249  FDIDestroy(hfdi);
250  }
251 
252  SetLastError(0xdeadbeef);
253  erf.erfOper = 0x1abe11ed;
254  erf.erfType = 0x5eed1e55;
255  erf.fError = 0x1ead1e55;
258  cpuUNKNOWN, &erf);
259  ok(hfdi != NULL, "Expected non-NULL context\n");
260  ok(GetLastError() == 0xdeadbeef,
261  "Expected 0xdeadbeef, got %d\n", GetLastError());
262  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
263  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
264  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
265 
266  FDIDestroy(hfdi);
267 
268  SetLastError(0xdeadbeef);
269  erf.erfOper = 0x1abe11ed;
270  erf.erfType = 0x5eed1e55;
271  erf.fError = 0x1ead1e55;
274  cpuUNKNOWN, &erf);
275  ok(hfdi != NULL, "Expected non-NULL context\n");
276  ok(GetLastError() == 0xdeadbeef,
277  "Expected 0xdeadbeef, got %d\n", GetLastError());
278  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
279  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
280  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
281 
282  FDIDestroy(hfdi);
283 
284  SetLastError(0xdeadbeef);
285  erf.erfOper = 0x1abe11ed;
286  erf.erfType = 0x5eed1e55;
287  erf.fError = 0x1ead1e55;
290  cpuUNKNOWN, &erf);
291  ok(hfdi != NULL, "Expected non-NULL context\n");
292  ok(GetLastError() == 0xdeadbeef,
293  "Expected 0xdeadbeef, got %d\n", GetLastError());
294  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
295  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
296  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
297 
298  FDIDestroy(hfdi);
299 
300  SetLastError(0xdeadbeef);
301  erf.erfOper = 0x1abe11ed;
302  erf.erfType = 0x5eed1e55;
303  erf.fError = 0x1ead1e55;
306  cpuUNKNOWN, &erf);
307  ok(hfdi != NULL, "Expected non-NULL context\n");
308  ok(GetLastError() == 0xdeadbeef,
309  "Expected 0xdeadbeef, got %d\n", GetLastError());
310  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
311  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
312  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
313 
314  FDIDestroy(hfdi);
315 
316  SetLastError(0xdeadbeef);
317  erf.erfOper = 0x1abe11ed;
318  erf.erfType = 0x5eed1e55;
319  erf.fError = 0x1ead1e55;
322  cpuUNKNOWN, &erf);
323  ok(hfdi != NULL, "Expected non-NULL context\n");
324  ok(GetLastError() == 0xdeadbeef,
325  "Expected 0xdeadbeef, got %d\n", GetLastError());
326  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
327  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
328  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
329 
330  FDIDestroy(hfdi);
331 
332  SetLastError(0xdeadbeef);
333  erf.erfOper = 0x1abe11ed;
334  erf.erfType = 0x5eed1e55;
335  erf.fError = 0x1ead1e55;
338  cpuUNKNOWN, NULL);
339  /* XP sets hfdi to a non-NULL value, but Vista sets it to NULL! */
340  ok(GetLastError() == 0xdeadbeef,
341  "Expected 0xdeadbeef, got %d\n", GetLastError());
342  /* NULL is passed to FDICreate instead of &erf, so don't retest the erf member values. */
343 
344  FDIDestroy(hfdi);
345 
346  /* bad cpu type */
347  SetLastError(0xdeadbeef);
348  erf.erfOper = 0x1abe11ed;
349  erf.erfType = 0x5eed1e55;
350  erf.fError = 0x1ead1e55;
353  0xcafebabe, &erf);
354  ok(hfdi != NULL, "Expected non-NULL context\n");
355  ok(GetLastError() == 0xdeadbeef,
356  "Expected 0xdeadbeef, got %d\n", GetLastError());
357  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
358  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
359  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
360 
361  FDIDestroy(hfdi);
362 
363  /* pfnalloc fails */
364  SetLastError(0xdeadbeef);
365  erf.erfOper = 0x1abe11ed;
366  erf.erfType = 0x5eed1e55;
367  erf.fError = 0x1ead1e55;
370  cpuUNKNOWN, &erf);
371  ok(hfdi == NULL, "Expected NULL context, got %p\n", hfdi);
372  ok(erf.erfOper == FDIERROR_ALLOC_FAIL,
373  "Expected FDIERROR_ALLOC_FAIL, got %d\n", erf.erfOper);
374  ok(erf.fError == TRUE, "Expected TRUE, got %d\n", erf.fError);
375  ok(GetLastError() == 0xdeadbeef,
376  "Expected 0xdeadbeef, got %d\n", GetLastError());
377  ok(erf.erfType == 0, "Expected 0, got %d\n", erf.erfType);
378 }
BOOL __cdecl FDIDestroy(HFDI hfdi)
Definition: fdi.c:2831
static UINT CDECL fdi_write(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:169
#define TRUE
Definition: types.h:120
static void CDECL fdi_free(void *pv)
Definition: fdi.c:145
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
Definition: fdi.c:150
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define cpuUNKNOWN
Definition: fdi.h:269
Definition: fci.h:44
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
HFDI __cdecl FDICreate(PFNALLOC pfnalloc, PFNFREE pfnfree, PFNOPEN pfnopen, PFNREAD pfnread, PFNWRITE pfnwrite, PFNCLOSE pfnclose, PFNSEEK pfnseek, int cpuType, PERF perf)
Definition: fdi.c:412
static int CDECL fdi_close(INT_PTR hf)
Definition: fdi.c:178
double __cdecl erf(double)
#define SetLastError(x)
Definition: compat.h:409
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:160
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:184
static void *CDECL fdi_alloc_bad(ULONG cb)
Definition: fdi.c:140
static void *CDECL fdi_alloc(ULONG cb)
Definition: fdi.c:135

Referenced by START_TEST().

◆ test_FDIDestroy()

static void test_FDIDestroy ( void  )
static

Definition at line 380 of file fdi.c.

381 {
382  HFDI hfdi;
383  ERF erf;
384  BOOL ret;
385 
386  /* native crashes if hfdi is NULL or invalid */
387 
390  cpuUNKNOWN, &erf);
391  ok(hfdi != NULL, "Expected non-NULL context\n");
392 
393  /* successfully destroy hfdi */
394  ret = FDIDestroy(hfdi);
395  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
396 
397  /* native crashes if you try to destroy hfdi twice */
398  if (0)
399  {
400  /* try to destroy hfdi again */
401  ret = FDIDestroy(hfdi);
402  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
403  }
404 }
BOOL __cdecl FDIDestroy(HFDI hfdi)
Definition: fdi.c:2831
static UINT CDECL fdi_write(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:169
#define TRUE
Definition: types.h:120
static void CDECL fdi_free(void *pv)
Definition: fdi.c:145
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
Definition: fdi.c:150
#define cpuUNKNOWN
Definition: fdi.h:269
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: fci.h:44
#define ok(value,...)
smooth NULL
Definition: ftsmooth.c:416
HFDI __cdecl FDICreate(PFNALLOC pfnalloc, PFNFREE pfnfree, PFNOPEN pfnopen, PFNREAD pfnread, PFNWRITE pfnwrite, PFNCLOSE pfnclose, PFNSEEK pfnseek, int cpuType, PERF perf)
Definition: fdi.c:412
static int CDECL fdi_close(INT_PTR hf)
Definition: fdi.c:178
double __cdecl erf(double)
int ret
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:160
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:184
static void *CDECL fdi_alloc(ULONG cb)
Definition: fdi.c:135

Referenced by START_TEST().

◆ test_FDIIsCabinet()

static void test_FDIIsCabinet ( void  )
static

Definition at line 653 of file fdi.c.

654 {
655  ERF erf;
656  BOOL ret;
657  HFDI hfdi;
658  INT_PTR fd;
659  FDICABINETINFO cabinfo;
660  char temp[] = "temp.txt";
661  char extract[] = "extract.cab";
662 
664  create_cab_file();
665 
668  cpuUNKNOWN, &erf);
669  ok(hfdi != NULL, "Expected non-NULL context\n");
670 
671  /* native crashes if hfdi or cabinfo are NULL or invalid */
672 
673  /* invalid file handle */
674  ZeroMemory(&cabinfo, sizeof(FDICABINETINFO));
675  SetLastError(0xdeadbeef);
676  ret = FDIIsCabinet(hfdi, -1, &cabinfo);
677  ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
679  "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
680  ok(cabinfo.cbCabinet == 0, "Expected 0, got %d\n", cabinfo.cbCabinet);
681  ok(cabinfo.cFiles == 0, "Expected 0, got %d\n", cabinfo.cFiles);
682  ok(cabinfo.cFolders == 0, "Expected 0, got %d\n", cabinfo.cFolders);
683  ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
684  ok(cabinfo.setID == 0, "Expected 0, got %d\n", cabinfo.setID);
685 
686  createTestFile("temp.txt");
687  fd = fdi_open(temp, 0, 0);
688 
689  /* file handle doesn't point to a cabinet */
690  ZeroMemory(&cabinfo, sizeof(FDICABINETINFO));
691  SetLastError(0xdeadbeef);
692  ret = FDIIsCabinet(hfdi, fd, &cabinfo);
693  ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
694  ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
695  ok(cabinfo.cbCabinet == 0, "Expected 0, got %d\n", cabinfo.cbCabinet);
696  ok(cabinfo.cFiles == 0, "Expected 0, got %d\n", cabinfo.cFiles);
697  ok(cabinfo.cFolders == 0, "Expected 0, got %d\n", cabinfo.cFolders);
698  ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
699  ok(cabinfo.setID == 0, "Expected 0, got %d\n", cabinfo.setID);
700 
701  fdi_close(fd);
702  DeleteFileA("temp.txt");
703 
704  /* try a real cab */
705  fd = fdi_open(extract, 0, 0);
706  ZeroMemory(&cabinfo, sizeof(FDICABINETINFO));
707  SetLastError(0xdeadbeef);
708  ret = FDIIsCabinet(hfdi, fd, &cabinfo);
709  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
710  ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
711  ok(cabinfo.cFiles == 4, "Expected 4, got %d\n", cabinfo.cFiles);
712  ok(cabinfo.cFolders == 1, "Expected 1, got %d\n", cabinfo.cFolders);
713  ok(cabinfo.setID == 0xbeef, "Expected 0xbeef, got %d\n", cabinfo.setID);
714  ok(cabinfo.cbCabinet == 182, "Expected 182, got %d\n", cabinfo.cbCabinet);
715  ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
716 
717  fdi_close(fd);
718  FDIDestroy(hfdi);
719 
722  cpuUNKNOWN, &erf);
723  ok(hfdi != NULL, "Expected non-NULL context\n");
724 
725  /* FDIIsCabinet accepts hf == 0 even though it's not a valid result of pfnopen */
727  ZeroMemory(&cabinfo, sizeof(FDICABINETINFO));
728  SetLastError(0xdeadbeef);
729  ret = FDIIsCabinet(hfdi, 0, &cabinfo);
730  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
731  ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
732  ok(cabinfo.cFiles == 4, "Expected 4, got %d\n", cabinfo.cFiles);
733  ok(cabinfo.cFolders == 1, "Expected 1, got %d\n", cabinfo.cFolders);
734  ok(cabinfo.setID == 0xbeef, "Expected 0xbeef, got %d\n", cabinfo.setID);
735  ok(cabinfo.cbCabinet == 182, "Expected 182, got %d\n", cabinfo.cbCabinet);
736  ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
737 
739  FDIDestroy(hfdi);
740 
742 }
static INT_PTR CDECL fdi_open_static(char *pszFile, int oflag, int pmode)
Definition: fdi.c:193
BOOL __cdecl FDIDestroy(HFDI hfdi)
Definition: fdi.c:2831
static UINT CDECL fdi_write(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:169
#define TRUE
Definition: types.h:120
static void CDECL fdi_free(void *pv)
Definition: fdi.c:145
USHORT setID
Definition: fdi.h:149
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
Definition: fdi.c:150
USHORT cFolders
Definition: fdi.h:147
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
static int fd
Definition: io.c:51
static UINT CDECL fdi_read_static(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:199
int32_t INT_PTR
Definition: typedefs.h:62
BOOL extract(char *filename, const bin_file *bin)
Definition: mspatcha.c:158
static void create_cab_file(void)
Definition: fdi.c:622
USHORT cFiles
Definition: fdi.h:148
#define cpuUNKNOWN
Definition: fdi.h:269
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: fci.h:44
#define ok(value,...)
static LONG CDECL fdi_seek_static(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:217
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
HFDI __cdecl FDICreate(PFNALLOC pfnalloc, PFNFREE pfnfree, PFNOPEN pfnopen, PFNREAD pfnread, PFNWRITE pfnwrite, PFNCLOSE pfnclose, PFNSEEK pfnseek, int cpuType, PERF perf)
Definition: fdi.c:412
LONG cbCabinet
Definition: fdi.h:146
static void createTestFile(const CHAR *name)
Definition: fdi.c:406
static UINT CDECL fdi_write_static(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:205
static int CDECL fdi_close(INT_PTR hf)
Definition: fdi.c:178
double __cdecl erf(double)
#define SetLastError(x)
Definition: compat.h:409
int ret
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:160
static void delete_test_files(void)
Definition: fdi.c:434
static calc_node_t temp
Definition: rpn_ieee.c:38
static void create_test_files(void)
Definition: fdi.c:418
static INT_PTR static_fdi_handle
Definition: fdi.c:191
USHORT iCabinet
Definition: fdi.h:150
BOOL __cdecl FDIIsCabinet(HFDI hfdi, INT_PTR hf, PFDICABINETINFO pfdici)
Definition: fdi.c:696
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:184
static int CDECL fdi_close_static(INT_PTR hf)
Definition: fdi.c:211
static void *CDECL fdi_alloc(ULONG cb)
Definition: fdi.c:135

Referenced by START_TEST().

Variable Documentation

◆ ab

UCHAR ab[sizeof("Hello World!") -1]

Definition at line 114 of file fdi.c.

Referenced by QuickLaunchBar::AddButton(), TaskBar::EnumWndProc(), and OnCreate().

◆ cab_data

const { ... } cab_data
Initial value:
=
{
{ {'M','S','C','F'}, 0, 0x59, 0, sizeof(struct CFHEADER) + sizeof(struct CFFOLDER), 0, 3,1, 1, 1, 0, 0x1225, 0x2013 },
{ sizeof(struct CFHEADER) + sizeof(struct CFFOLDER) + sizeof(struct CFFILE) + sizeof("file.dat"), 1, tcompTYPE_NONE },
{ sizeof("Hello World!")-1, 0, 0x1234, 0x1225, 0x2013, 0xa114 },
{ 'f','i','l','e','.','d','a','t',0 },
{ 0, sizeof("Hello World!")-1, sizeof("Hello World!")-1 },
{ 'H','e','l','l','o',' ','W','o','r','l','d','!' }
}
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
Definition: fci.c:82
#define tcompTYPE_NONE
Definition: fci.h:64
Definition: fci.c:89
Definition: fci.c:65
Definition: fci.c:126

Referenced by fdi_mem_open().

◆ CURR_DIR

CHAR CURR_DIR[MAX_PATH]
static

Definition at line 32 of file fdi.c.

Referenced by add_file(), create_test_files(), set_cab_parameters(), and test_FDICopy().

◆ data

Definition at line 113 of file fdi.c.

Referenced by checksum(), fdi_decomp(), and fdi_mem_open().

◆ file

Definition at line 111 of file fdi.c.

Referenced by createTestFile(), fdi_decomp(), and FDICopy().

◆ folder

◆ header

struct CFHEADER header

Definition at line 109 of file fdi.c.

Referenced by _chm_find_in_PMGI(), _chm_find_in_PMGL(), add_cookie_headers(), add_param(), add_request_headers(), AllocateDictionaryEntry(), Atapi2Scsi(), auth_scheme_from_header(), Base64WithHeaderAndTrailerToBinaryA(), Base64WithHeaderAndTrailerToBinaryW(), BinaryToBase64A(), BinaryToBase64W(), BSTR_UserMarshal(), BSTR_UserUnmarshal(), build_clr_surrogate_section(), build_comserver_section(), build_dllredirect_section(), build_ifaceps_section(), build_progid_section(), build_tlib_section(), build_wndclass_section(), cache_container_clean_index(), cache_container_is_valid(), cache_container_open_index(), cache_container_set_size(), CDataEncodeMsg_Update(), CdRomDeviceControlCompletion(), CdRomFindFeaturePage(), CdRomGetConfiguration(), CdRompPrintAllFeaturePages(), check_bitmap_header_(), check_iml_data(), check_storage_contents(), check_updates(), check_variant_header(), chm_enumerate_dir(), ClasspInitializeGesn(), clnt_cb_thread(), commit_cache_entry(), compareAuthorityInfoAccess(), compareCTLInfo(), compareSMimeCapabilities(), convert_dib_to_bmp(), create_outline(), CRYPT_EncodeDataContentInfoHeader(), d3drm3_Load(), d3drm_mesh_builder3_Load(), d3drm_texture_load(), decodeAndCompareBase64_A(), deflate(), DIB_GetBitmapInfo(), BtrfsRecv::do_recv(), do_write_c_method_def(), DoOpenFile(), dump_ani_header(), dump_types(), dump_vm_counters(), EmitREBytecode(), empty_header_list(), encode_compare_base64_W(), encodeAndCompareBase64_A(), EnumColorProfilesA(), EnumColorProfilesW(), export_file_header(), ext4_xattr_compute_hash(), ext4_xattr_entry_data(), ext4_xattr_inode_fetch(), ext4_xattr_rehash(), ext4_xattr_set_block_checksum(), find_prop(), fnt_font_load(), FNT_Size_Request(), FNT_Size_Select(), for_each_serializable(), formatopts_proc(), free_header(), FreeDictionaryEntry(), FreeUrlCacheSpaceW(), FSE_writeNCount_generic(), FT_Get_WinFNT_Header(), GdipCreateMetafileFromEmf(), GdipGetMetafileHeaderFromEmf(), GdipGetMetafileHeaderFromFile(), GdipGetMetafileHeaderFromMetafile(), GdipGetMetafileHeaderFromStream(), GdipGetMetafileHeaderFromWmf(), GdipGetRegionData(), GdipGetRegionDataSize(), GdipPlayMetafileRecord(), generate_xa_rr_attributes(), get_channel_http_header(), get_cmap(), get_cookie_header(), get_emfplus_header_proc(), get_first_last_from_cmap(), get_host_header(), get_image_info_from_dds(), get_ndr_types_params(), get_subtests(), get_ttf_nametable_entry(), GetColorProfileFromHandle(), GetColorProfileHeader(), getConvertedFrameAndBounds(), GetConvertStg(), GPOS_apply_MarkToBase(), GSUB_apply_feature_all_lookups(), has_png_transparency_chunk(), header_from_file(), HEADER_SetOrderArray(), header_state(), HLPFILE_ReadFileToBuffer(), HTMLXMLHttpRequest_getResponseHeader(), HTTP_InsertAuthorization(), HttpSendRequestExA(), ID3DXFontImpl_DrawTextW(), IDirectMusicBufferImpl_PackStructured(), IDirectMusicBufferImpl_PackUnstructured(), imagelist_get_bitmap_size(), import_base64_certs_from_fp(), init_content_encoding(), init_content_type(), init_psfactory(), init_stream_header(), insert_authorization_header(), insert_content_length_header(), insert_header(), is_v6_header(), is_win_xp(), iso_dump_types(), load_cube_texture_from_dds(), load_mf_pict(), load_ole_stream(), load_surface_from_dds(), load_texture_from_dds(), load_ttf_name_id(), load_volume_from_dds(), load_volume_texture_from_dds(), main(), Marshal_ReleaseMarshalData(), Marshal_UnmarshalInterface(), METAFILE_GraphicsDeleted(), METAFILE_WriteHeader(), MimeBody_GetParameters(), MimeBody_GetProp(), MimeBody_GetPropInfo(), MimeBody_SetProp(), MPEGSplitter_head_check(), MPEGSplitter_init_audio(), MPEGSplitter_pre_connect(), MPEGSplitter_seek(), mpg123_framedata(), msi_export_summaryinformation(), nls_from_txt(), nls_print_header(), nsChannel_GetResponseHeader(), nsChannel_IsNoStoreResponse(), nsChannel_SetResponseHeader(), OLEPictureImpl_Load(), OLEPictureImpl_LoadAPM(), OLEPictureImpl_Save(), OnNotifySettingsPage(), OpenType_apply_GPOS_lookup(), OpenType_apply_GSUB_lookup(), OpenType_GDEF_UpdateGlyphProps(), parse_header(), parse_headers(), parse_pres_streams(), pass(), PATH_add_outline(), pfr_header_check(), pfr_header_load(), process_header(), process_response_status_text(), ProcessLongMidiMessage(), Protocol_Continue(), ProtocolEmul_Continue(), query_headers(), read_msft_importlib(), read_png_chunk(), read_reply(), read_value(), REBAR_ValidateBand(), REGPROC_open_export_file(), ReturnCompletedBuffers(), RPCRT4_BuildAuthHeader(), RPCRT4_BuildBindAckHeader(), RPCRT4_BuildBindHeader(), RPCRT4_BuildBindNackHeader(), RPCRT4_BuildFaultHeader(), RPCRT4_BuildHttpConnectHeader(), RPCRT4_BuildHttpFlowControlHeader(), RPCRT4_BuildHttpHeader(), RPCRT4_BuildRequestHeader(), RPCRT4_BuildResponseHeader(), RPCRT4_ParseHttpFlowControlHeader(), RPCRT4_ParseHttpPrepareHeader1(), RPCRT4_ParseHttpPrepareHeader2(), save_dds_surface_to_memory(), save_dib(), save_emf(), save_mfpict(), save_view_cache(), scan_revoke_records(), SdbpOpenDatabase(), send_subvol(), set_http_header(), set_input_fragment(), set_profile_device_key(), set_window(), SetColorProfileHeader(), SetConvertStg(), sltg_write_header(), split_params(), SPY_DumpMem(), synthesize_dib(), SystemApplet(), test_chunked_read(), test_columns(), test_columnscreation(), test_createfromwmf(), test_CreateStub(), test_DPA_LoadStream(), test_editbox(), test_emfonly(), test_empty(), test_encode(), test_find_com_redirection(), test_find_progid_redirection(), test_find_window_class(), test_gditransform(), test_GetColorProfileHeader(), test_GetGlyphOutline_empty_contour(), test_getitemposition(), test_header_notification(), test_header_notification2(), test_header_presence_(), test_header_proc(), test_HttpSendRequestW(), test_ICSeqCompress(), test_imagelists(), test_import_hmac(), test_loadwmf(), test_LVS_EX_HEADERINALLVIEWS(), test_NdrDllGetClassObject(), test_nosortheader(), test_notifyformat(), test_OleLoad(), test_olestream(), test_pic(), test_rc2_keylen(), test_SetColorProfileHeader(), test_wmreader_interfaces(), test_wmwriter_interfaces(), TestClassRedirection(), TextStoreACPServices_Serialize(), TextStoreACPServices_Unserialize(), BtrfsSend::Thread(), tt_face_get_metrics(), tt_face_load_generic_header(), tt_face_load_hhea(), txt_get_header(), unfold_header(), urlcache_clean_leaked_entries(), urlcache_copy_entry(), urlcache_create_hash_table(), urlcache_delete_file(), urlcache_entry_alloc(), urlcache_entry_commit(), urlcache_entry_create(), urlcache_entry_free(), urlcache_entry_get_file(), urlcache_get_entry_info(), urlcache_next_entry(), URLDownloadToCacheFileW(), VarFormatFromTokens(), VARIANT_FormatDate(), VARIANT_FormatNumber(), VARIANT_FormatString(), VARIANT_UserMarshal(), VARIANT_UserUnmarshal(), VarTokenizeFormatString(), visit_http_headers(), winhttp_request_GetResponseHeader(), winhttp_request_SetRequestHeader(), write_c_disp_method_def(), write_c_method_def(), write_coclass(), write_coclass_forward(), write_com_interface_end(), write_com_interface_start(), write_context_handle_rundowns(), write_cpp_method_def(), write_declaration(), write_forward(), write_forward_decls(), write_function_proto(), write_generic_handle_routines(), write_header(), write_header_stmts(), write_import(), write_imports(), write_inline_wrappers(), write_library(), write_method_macro(), write_method_proto(), write_namespace_end(), write_namespace_start(), write_path_data(), write_region_data(), write_rpc_interface_end(), write_rpc_interface_start(), write_serialize_function_decl(), write_typedef(), write_user_types(), and zipRemoveExtraInfoBlock().

◆ static_fdi_handle

INT_PTR static_fdi_handle
static

Definition at line 191 of file fdi.c.

Referenced by fdi_read_static(), fdi_seek_static(), and test_FDIIsCabinet().

◆ szName

UCHAR szName[sizeof("file.dat")]

Definition at line 112 of file fdi.c.