ReactOS  0.4.14-dev-608-gd495a4f
fdi.c File Reference
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.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
 

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

◆ FOLDER_THRESHOLD

#define FOLDER_THRESHOLD   900000

Definition at line 32 of file fdi.c.

◆ MEDIA_SIZE

#define MEDIA_SIZE   999999999

Definition at line 31 of file fdi.c.

Function Documentation

◆ add_file()

static void add_file ( HFCI  hfci,
char file 
)
static

Definition at line 588 of file fdi.c.

589 {
590  char path[MAX_PATH];
591  BOOL res;
592 
594  lstrcatA(path, "\\");
595  lstrcatA(path, file);
596 
599  ok(res, "Expected FCIAddFile to succeed\n");
600 }
static CHAR CURR_DIR[MAX_PATH]
Definition: fdi.c:34
#define tcompTYPE_MSZIP
Definition: fci.h:65
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: fdi.c:449
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:454
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define ok(value,...)
Definition: atltest.h:57
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:559
Definition: fci.c:126

Referenced by create_cab_file().

◆ CopyProgress()

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

Definition at line 737 of file fdi.c.

738 {
739  return 37; /* doc says 0, but anything != -1 apparently means success as well */
740 }

Referenced by test_FDICopy().

◆ create_cab_file()

static void create_cab_file ( void  )
static

Definition at line 614 of file fdi.c.

615 {
616  CCAB cabParams;
617  HFCI hfci;
618  ERF erf;
619  static CHAR a_txt[] = "a.txt",
620  b_txt[] = "b.txt",
621  testdir_c_txt[] = "testdir\\c.txt",
622  testdir_d_txt[] = "testdir\\d.txt";
623  BOOL res;
624 
625  set_cab_parameters(&cabParams);
626 
629  get_temp_file, &cabParams, NULL);
630 
631  ok(hfci != NULL, "Failed to create an FCI context\n");
632 
633  add_file(hfci, a_txt);
634  add_file(hfci, b_txt);
635  add_file(hfci, testdir_c_txt);
636  add_file(hfci, testdir_d_txt);
637 
639  ok(res, "Failed to flush the cabinet\n");
640 
641  res = FCIDestroy(hfci);
642  ok(res, "Failed to destroy the cabinet\n");
643 }
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: fdi.c:540
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:489
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:588
Definition: fci.h:144
static int CDECL fci_delete(char *pszFile, int *err, void *pv)
Definition: fdi.c:532
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: fci.h:44
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fdi.c:501
smooth NULL
Definition: ftsmooth.c:416
static BOOL CDECL get_next_cabinet(PCCAB pccab, ULONG cbPrevCab, void *pv)
Definition: fdi.c:449
double __cdecl erf(double)
static LONG CDECL progress(UINT typeStatus, ULONG cb1, ULONG cb2, void *pv)
Definition: fdi.c:454
static void *CDECL mem_alloc(ULONG cb)
Definition: fdi.c:439
static LONG CDECL fci_seek(INT_PTR hf, LONG dist, int seektype, int *err, void *pv)
Definition: fdi.c:521
#define ok(value,...)
Definition: atltest.h:57
static void CDECL mem_free(void *memory)
Definition: fdi.c:444
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: fdi.c:459
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:465
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: fdi.c:513
static void set_cab_parameters(PCCAB pCabParams)
Definition: fdi.c:602

Referenced by test_FDIIsCabinet().

◆ create_test_files()

static void create_test_files ( void  )
static

Definition at line 410 of file fdi.c.

411 {
412  DWORD len;
413 
415 
416  if(len && (CURR_DIR[len-1] == '\\'))
417  CURR_DIR[len-1] = 0;
418 
419  createTestFile("a.txt");
420  createTestFile("b.txt");
421  CreateDirectoryA("testdir", NULL);
422  createTestFile("testdir\\c.txt");
423  createTestFile("testdir\\d.txt");
424 }
static CHAR CURR_DIR[MAX_PATH]
Definition: fdi.c:34
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:398
#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 398 of file fdi.c.

399 {
400  HANDLE file;
401  DWORD written;
402 
404  ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
405  WriteFile(file, name, strlen(name), &written, NULL);
406  WriteFile(file, "\n", strlen("\n"), &written, NULL);
407  CloseHandle(file);
408 }
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:406
struct CFFILE file
Definition: fdi.c:103
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#define GENERIC_WRITE
Definition: nt_native.h:90
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CREATE_ALWAYS
Definition: disk.h:72
#define ok(value,...)
Definition: atltest.h:57
Definition: name.c:38
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407
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 426 of file fdi.c.

427 {
428  DeleteFileA("a.txt");
429  DeleteFileA("b.txt");
430  DeleteFileA("testdir\\c.txt");
431  DeleteFileA("testdir\\d.txt");
432  RemoveDirectoryA("testdir");
433 
434  DeleteFileA("extract.cab");
435 }
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 513 of file fdi.c.

514 {
515  HANDLE handle = (HANDLE)hf;
516  ok(CloseHandle(handle), "Failed to CloseHandle\n");
517 
518  return 0;
519 }
#define CloseHandle
Definition: compat.h:406
PVOID HANDLE
Definition: typedefs.h:71
#define ok(value,...)
Definition: atltest.h:57

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 532 of file fdi.c.

533 {
534  BOOL ret = DeleteFileA(pszFile);
535  ok(ret, "Failed to DeleteFile %s\n", pszFile);
536 
537  return 0;
538 }
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
int ret
#define ok(value,...)
Definition: atltest.h:57

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 465 of file fdi.c.

466 {
467  HANDLE handle;
468  DWORD dwAccess = 0;
469  DWORD dwShareMode = 0;
470  DWORD dwCreateDisposition = OPEN_EXISTING;
471 
472  dwAccess = GENERIC_READ | GENERIC_WRITE;
473  /* FILE_SHARE_DELETE is not supported by Windows Me/98/95 */
474  dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
475 
477  dwCreateDisposition = OPEN_EXISTING;
478  else
479  dwCreateDisposition = CREATE_NEW;
480 
481  handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
482  dwCreateDisposition, 0, NULL);
483 
484  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszFile);
485 
486  return (INT_PTR)handle;
487 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#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
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:434
unsigned long DWORD
Definition: ntddk_ex.h:95
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define GENERIC_READ
Definition: compat.h:124
#define ok(value,...)
Definition: atltest.h:57
#define CREATE_NEW
Definition: disk.h:69
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407

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 489 of file fdi.c.

490 {
491  HANDLE handle = (HANDLE)hf;
492  DWORD dwRead;
493  BOOL res;
494 
495  res = ReadFile(handle, memory, cb, &dwRead, NULL);
496  ok(res, "Failed to ReadFile\n");
497 
498  return dwRead;
499 }
static char memory[1024 *256]
Definition: process.c:116
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
#define ok(value,...)
Definition: atltest.h:57
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
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 521 of file fdi.c.

522 {
523  HANDLE handle = (HANDLE)hf;
524  DWORD ret;
525 
526  ret = SetFilePointer(handle, dist, NULL, seektype);
527  ok(ret != INVALID_SET_FILE_POINTER, "Failed to SetFilePointer\n");
528 
529  return ret;
530 }
#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
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
int ret
#define ok(value,...)
Definition: atltest.h:57

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 501 of file fdi.c.

502 {
503  HANDLE handle = (HANDLE)hf;
504  DWORD dwWritten;
505  BOOL res;
506 
507  res = WriteFile(handle, memory, cb, &dwWritten, NULL);
508  ok(res, "Failed to WriteFile\n");
509 
510  return dwWritten;
511 }
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
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
#define ok(value,...)
Definition: atltest.h:57
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
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 127 of file fdi.c.

128 {
129  return HeapAlloc(GetProcessHeap(), 0, cb);
130 }
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32

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 132 of file fdi.c.

133 {
134  return NULL;
135 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by test_FDICreate().

◆ fdi_close()

static int CDECL fdi_close ( INT_PTR  hf)
static

Definition at line 170 of file fdi.c.

171 {
172  HANDLE handle = (HANDLE) hf;
173  return CloseHandle(handle) ? 0 : -1;
174 }
#define CloseHandle
Definition: compat.h:406
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 203 of file fdi.c.

204 {
205  ok(0, "FDIIsCabinet shouldn't call pfnclose\n");
206  return 0;
207 }
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_FDIIsCabinet().

◆ fdi_free()

static void CDECL fdi_free ( void pv)
static

Definition at line 137 of file fdi.c.

138 {
139  HeapFree(GetProcessHeap(), 0, pv);
140 }
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

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 790 of file fdi.c.

791 {
792  HeapFree(GetProcessHeap(), 0, (void *)hf);
793  return 0;
794 }
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by test_FDICopy().

◆ fdi_mem_notify()

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

Definition at line 823 of file fdi.c.

824 {
825  static const char expected[9] = "file.dat\0";
826 
827  switch (fdint)
828  {
830  trace("mem_notify: CLOSE_FILE_INFO %s, handle %#lx\n", info->psz1, info->hf);
831 
832  ok(!strcmp(info->psz1, expected), "expected %s, got %s\n", expected, info->psz1);
833  ok(info->date == 0x1225, "expected 0x1225, got %#x\n", info->date);
834  ok(info->time == 0x2013, "expected 0x2013, got %#x\n", info->time);
835  ok(info->attribs == 0xa114, "expected 0xa114, got %#x\n", info->attribs);
836  ok(info->iFolder == 0x1234, "expected 0x1234, got %#x\n", info->iFolder);
837  return 1;
838 
839  case fdintCOPY_FILE:
840  {
841  trace("mem_notify: COPY_FILE %s, %d bytes\n", info->psz1, info->cb);
842 
843  ok(info->cb == 12, "expected 12, got %u\n", info->cb);
844  ok(!strcmp(info->psz1, expected), "expected %s, got %s\n", expected, info->psz1);
845  ok(info->iFolder == 0x1234, "expected 0x1234, got %#x\n", info->iFolder);
846  return 0x12345678; /* call write() callback */
847  }
848 
849  default:
850  trace("mem_notify(%d,%p)\n", fdint, info);
851  return 0;
852  }
853 
854  return 0;
855 }
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
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 742 of file fdi.c.

743 {
744  static const char expected[] = "memory\\block";
745  struct mem_data *data;
746 
747  ok(!strcmp(name, expected), "expected %s, got %s\n", expected, name);
748  ok(oflag == _O_BINARY, "expected _O_BINARY, got %x\n", oflag);
749  ok(pmode == (_S_IREAD | _S_IWRITE), "expected _S_IREAD | _S_IWRITE, got %x\n", pmode);
750 
751  data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data));
752  if (!data) return -1;
753 
754  data->base = (const char *)&cab_data;
755  data->size = sizeof(cab_data);
756  data->pos = 0;
757 
758  trace("mem_open(%s,%x,%x) => %p\n", name, oflag, pmode, data);
759  return (INT_PTR)data;
760 }
#define _S_IREAD
Definition: cabinet.h:34
int32_t INT_PTR
Definition: typedefs.h:62
struct CFDATA data
Definition: fdi.c:105
#define _S_IWRITE
Definition: cabinet.h:33
#define GetProcessHeap()
Definition: compat.h:403
#define trace
Definition: atltest.h:70
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static const struct @1600 cab_data
Definition: fdi.c:119
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define _O_BINARY
Definition: cabinet.h:51
#define ok(value,...)
Definition: atltest.h:57
Definition: name.c:38
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
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 762 of file fdi.c.

763 {
764  struct mem_data *data = (struct mem_data *)hf;
765  UINT available, cb_read;
766 
767  available = data->size - data->pos;
768  cb_read = (available >= cb) ? cb : available;
769 
770  memcpy(pv, data->base + data->pos, cb_read);
771  data->pos += cb_read;
772 
773  /*trace("mem_read(%p,%p,%u) => %u\n", hf, pv, cb, cb_read);*/
774  return cb_read;
775 }
static WCHAR available[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2336
Definition: fdi.c:119
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
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32

Referenced by test_FDICopy().

◆ fdi_mem_seek()

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

Definition at line 796 of file fdi.c.

797 {
798  struct mem_data *data = (struct mem_data *)hf;
799 
800  switch (seektype)
801  {
802  case SEEK_SET:
803  data->pos = dist;
804  break;
805 
806  case SEEK_CUR:
807  data->pos += dist;
808  break;
809 
810  case SEEK_END:
811  default:
812  ok(0, "seek: not expected type %d\n", seektype);
813  return -1;
814  }
815 
816  if (data->pos < 0) data->pos = 0;
817  if (data->pos > data->size) data->pos = data->size;
818 
819  /*mem_seek(%p,%d,%d) => %u\n", hf, dist, seektype, data->pos);*/
820  return data->pos;
821 }
#define SEEK_CUR
Definition: util.h:63
#define SEEK_SET
Definition: jmemansi.c:26
Definition: fdi.c:119
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define ok(value,...)
Definition: atltest.h:57
#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 777 of file fdi.c.

778 {
779  static const char expected[] = "Hello World!";
780 
781  trace("mem_write(%#lx,%p,%u)\n", hf, pv, cb);
782 
783  ok(hf == 0x12345678, "expected 0x12345678, got %#lx\n", hf);
784  ok(cb == 12, "expected 12, got %u\n", cb);
785  ok(!memcmp(pv, expected, 12), "expected %s, got %s\n", expected, (const char *)pv);
786 
787  return cb;
788 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
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 142 of file fdi.c.

143 {
144  HANDLE handle;
146  OPEN_EXISTING, 0, NULL );
148  return 0;
149  return (INT_PTR) handle;
150 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
#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:434
#define GENERIC_READ
Definition: compat.h:124
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407

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 185 of file fdi.c.

186 {
187  ok(0, "FDIIsCabinet shouldn't call pfnopen\n");
188  return 1;
189 }
#define ok(value,...)
Definition: atltest.h:57

Referenced by test_FDIIsCabinet().

◆ fdi_read()

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

Definition at line 152 of file fdi.c.

153 {
154  HANDLE handle = (HANDLE) hf;
155  DWORD dwRead;
156  if (ReadFile(handle, pv, cb, &dwRead, NULL))
157  return dwRead;
158  return 0;
159 }
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
PVOID HANDLE
Definition: typedefs.h:71
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
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 191 of file fdi.c.

192 {
193  ok(hf == 0, "unexpected hf %lx\n", hf);
194  return fdi_read(static_fdi_handle, pv, cb);
195 }
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:152
#define ok(value,...)
Definition: atltest.h:57
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
static INT_PTR static_fdi_handle
Definition: fdi.c:183

Referenced by test_FDIIsCabinet().

◆ fdi_seek()

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

Definition at line 176 of file fdi.c.

177 {
178  HANDLE handle = (HANDLE) hf;
179  return SetFilePointer(handle, dist, NULL, seektype);
180 }
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 209 of file fdi.c.

210 {
211  ok(hf == 0, "unexpected hf %lx\n", hf);
212  return fdi_seek(static_fdi_handle, dist, seektype);
213 }
#define ok(value,...)
Definition: atltest.h:57
static INT_PTR static_fdi_handle
Definition: fdi.c:183
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:176

Referenced by test_FDIIsCabinet().

◆ fdi_write()

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

Definition at line 161 of file fdi.c.

162 {
163  HANDLE handle = (HANDLE) hf;
164  DWORD dwWritten;
165  if (WriteFile(handle, pv, cb, &dwWritten, NULL))
166  return dwWritten;
167  return 0;
168 }
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 HMODULE MODULEINFO DWORD cb
Definition: module.c:32

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 197 of file fdi.c.

198 {
199  ok(0, "FDIIsCabinet shouldn't call pfnwrite\n");
200  return 0;
201 }
#define ok(value,...)
Definition: atltest.h:57

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 459 of file fdi.c.

461 {
462  return 0;
463 }

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 449 of file fdi.c.

450 {
451  return TRUE;
452 }
#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 559 of file fdi.c.

561 {
564  HANDLE handle;
565  DWORD attrs;
566  BOOL res;
567 
570 
571  ok(handle != INVALID_HANDLE_VALUE, "Failed to CreateFile %s\n", pszName);
572 
574  ok(res, "Expected GetFileInformationByHandle to succeed\n");
575 
577  FileTimeToDosDateTime(&filetime, pdate, ptime);
578 
579  attrs = GetFileAttributesA(pszName);
580  ok(attrs != INVALID_FILE_ATTRIBUTES, "Failed to GetFileAttributes\n");
581  /* fixme: should convert attrs to *pattribs, make sure
582  * have a test that catches the fact that we don't?
583  */
584 
585  return (INT_PTR)handle;
586 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
int32_t INT_PTR
Definition: typedefs.h:62
BOOL WINAPI FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, OUT LPFILETIME lpLocalFileTime)
Definition: time.c:221
#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
smooth NULL
Definition: ftsmooth.c:416
#define OPEN_EXISTING
Definition: compat.h:434
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
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:407

Referenced by add_file().

◆ get_temp_file()

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

Definition at line 540 of file fdi.c.

541 {
542  LPSTR tempname;
543 
544  tempname = HeapAlloc(GetProcessHeap(), 0, MAX_PATH);
545  GetTempFileNameA(".", "xx", 0, tempname);
546 
547  if (tempname && (strlen(tempname) < (unsigned)cbTempName))
548  {
549  lstrcpyA(pszTempName, tempname);
550  HeapFree(GetProcessHeap(), 0, tempname);
551  return TRUE;
552  }
553 
554  HeapFree(GetProcessHeap(), 0, tempname);
555 
556  return FALSE;
557 }
#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:403
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:402

Referenced by create_cab_file(), and test_FDICopy().

◆ mem_alloc()

static void* CDECL mem_alloc ( ULONG  cb)
static

Definition at line 439 of file fdi.c.

440 {
441  return HeapAlloc(GetProcessHeap(), 0, cb);
442 }
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32

Referenced by create_cab_file(), and test_FDICopy().

◆ mem_free()

static void CDECL mem_free ( void memory)
static

Definition at line 444 of file fdi.c.

445 {
447 }
static char memory[1024 *256]
Definition: process.c:116
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

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 454 of file fdi.c.

455 {
456  return 0;
457 }

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

◆ set_cab_parameters()

static void set_cab_parameters ( PCCAB  pCabParams)
static

Definition at line 602 of file fdi.c.

603 {
604  ZeroMemory(pCabParams, sizeof(CCAB));
605 
606  pCabParams->cb = MEDIA_SIZE;
607  pCabParams->cbFolderThresh = FOLDER_THRESHOLD;
608  pCabParams->setID = 0xbeef;
609  lstrcpyA(pCabParams->szCabPath, CURR_DIR);
610  lstrcatA(pCabParams->szCabPath, "\\");
611  lstrcpyA(pCabParams->szCab, "extract.cab");
612 }
ULONG cbFolderThresh
Definition: fci.h:146
static CHAR CURR_DIR[MAX_PATH]
Definition: fdi.c:34
#define ZeroMemory
Definition: winbase.h:1642
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:31
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define FOLDER_THRESHOLD
Definition: fdi.c:32
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 945 of file fdi.c.

946 {
947  test_FDICreate();
948  test_FDIDestroy();
950  test_FDICopy();
951 }
static void test_FDIIsCabinet(void)
Definition: fdi.c:645
static void test_FDICreate(void)
Definition: fdi.c:215
static void test_FDICopy(void)
Definition: fdi.c:857
static void test_FDIDestroy(void)
Definition: fdi.c:372

◆ test_FDICopy()

static void test_FDICopy ( void  )
static

Definition at line 857 of file fdi.c.

858 {
859  CCAB cabParams;
860  HFDI hfdi;
861  HFCI hfci;
862  ERF erf;
863  BOOL ret;
864  char name[] = "extract.cab";
865  char path[MAX_PATH + 1];
866  char memory_block[] = "memory\\block";
867  char memory[] = "memory\\";
868  char block[] = "block";
870  INT_PTR fd;
871 
872  set_cab_parameters(&cabParams);
873 
876  fci_delete, get_temp_file, &cabParams, NULL);
877 
879  ok(ret, "Failed to flush the cabinet\n");
880 
881  FCIDestroy(hfci);
882 
884 
885  /* path doesn't have a trailing backslash */
886  if (lstrlenA(path) > 2)
887  {
890  cpuUNKNOWN, &erf);
891 
892  SetLastError(0xdeadbeef);
893  ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
894  ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
896  "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
897 
898  FDIDestroy(hfdi);
899  }
900  else
901  skip("Running on a root drive directory.\n");
902 
903  lstrcatA(path, "\\");
904 
907  cpuUNKNOWN, &erf);
908 
909  /* cabinet with no files or folders */
910  SetLastError(0xdeadbeef);
911  ret = FDICopy(hfdi, name, path, 0, CopyProgress, NULL, 0);
912  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
913  ok(GetLastError() == 0, "Expected 0f, got %d\n", GetLastError());
914 
915  FDIDestroy(hfdi);
916 
917  DeleteFileA(name);
918 
919  /* test extracting from a memory block */
922  ok(hfdi != NULL, "FDICreate error %d\n", erf.erfOper);
923 
924  fd = fdi_mem_open(memory_block, _O_BINARY, _S_IREAD | _S_IWRITE);
925  ok(fd != -1, "fdi_open failed\n");
926 
927  memset(&info, 0, sizeof(info));
928  ret = FDIIsCabinet(hfdi, fd, &info);
929  ok(ret, "FDIIsCabinet error %d\n", erf.erfOper);
930  ok(info.cbCabinet == 0x59, "expected 0x59, got %#x\n", info.cbCabinet);
931  ok(info.cFiles == 1, "expected 1, got %d\n", info.cFiles);
932  ok(info.cFolders == 1, "expected 1, got %d\n", info.cFolders);
933  ok(info.setID == 0x1225, "expected 0x1225, got %#x\n", info.setID);
934  ok(info.iCabinet == 0x2013, "expected 0x2013, got %#x\n", info.iCabinet);
935 
936  fdi_mem_close(fd);
937 
938  ret = FDICopy(hfdi, block, memory, 0, fdi_mem_notify, NULL, 0);
939  ok(ret, "FDICopy error %d\n", erf.erfOper);
940 
941  FDIDestroy(hfdi);
942 }
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:161
static BOOL CDECL get_temp_file(char *pszTempName, int cbTempName, void *pv)
Definition: fdi.c:540
#define TRUE
Definition: types.h:120
#define _S_IREAD
Definition: cabinet.h:34
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:34
static INT_PTR __cdecl CopyProgress(FDINOTIFICATIONTYPE fdint, PFDINOTIFICATION pfdin)
Definition: fdi.c:737
static void CDECL fdi_free(void *pv)
Definition: fdi.c:137
static UINT CDECL fci_read(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fdi.c:489
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
Definition: fdi.c:142
static INT_PTR CDECL fdi_mem_notify(FDINOTIFICATIONTYPE fdint, FDINOTIFICATION *info)
Definition: fdi.c:823
#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:777
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:532
#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
static UINT CDECL fci_write(INT_PTR hf, void *memory, UINT cb, int *err, void *pv)
Definition: fdi.c:501
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:449
#define _S_IWRITE
Definition: cabinet.h:33
static int CDECL fdi_mem_close(INT_PTR hf)
Definition: fdi.c:790
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:762
static int CDECL fdi_close(INT_PTR hf)
Definition: fdi.c:170
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:454
#define SetLastError(x)
Definition: compat.h:417
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:742
int ret
#define _O_BINARY
Definition: cabinet.h:51
static LONG CDECL fdi_mem_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:796
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:152
static void *CDECL mem_alloc(ULONG cb)
Definition: fdi.c:439
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:521
#define ok(value,...)
Definition: atltest.h:57
static void CDECL mem_free(void *memory)
Definition: fdi.c:444
#define skip(...)
Definition: atltest.h:64
static int CDECL file_placed(PCCAB pccab, char *pszFile, LONG cbFile, BOOL fContinuation, void *pv)
Definition: fdi.c:459
Definition: name.c:38
BOOL __cdecl FDIIsCabinet(HFDI hfdi, INT_PTR hf, PFDICABINETINFO pfdici)
Definition: fdi.c:696
static INT_PTR CDECL fci_open(char *pszFile, int oflag, int pmode, int *err, void *pv)
Definition: fdi.c:465
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:176
static int CDECL fci_close(INT_PTR hf, int *err, void *pv)
Definition: fdi.c:513
#define memset(x, y, z)
Definition: compat.h:39
static void set_cab_parameters(PCCAB pCabParams)
Definition: fdi.c:602
static void *CDECL fdi_alloc(ULONG cb)
Definition: fdi.c:127

Referenced by START_TEST().

◆ test_FDICreate()

static void test_FDICreate ( void  )
static

Definition at line 215 of file fdi.c.

216 {
217  HFDI hfdi;
218  ERF erf;
219 
220  /* native crashes if pfnalloc is NULL */
221 
222  /* FDICreate does not crash with a NULL pfnfree,
223  * but FDIDestroy will crash when it tries to access it.
224  */
225  if (0)
226  {
227  SetLastError(0xdeadbeef);
228  erf.erfOper = 0x1abe11ed;
229  erf.erfType = 0x5eed1e55;
230  erf.fError = 0x1ead1e55;
233  cpuUNKNOWN, &erf);
234  ok(hfdi != NULL, "Expected non-NULL context\n");
235  ok(GetLastError() == 0xdeadbeef,
236  "Expected 0xdeadbeef, got %d\n", GetLastError());
237  ok(erf.erfOper == 0x1abe11ed, "Expected 0x1abe11ed, got %d\n", erf.erfOper);
238  ok(erf.erfType == 0x5eed1e55, "Expected 0x5eed1e55, got %d\n", erf.erfType);
239  ok(erf.fError == 0x1ead1e55, "Expected 0x1ead1e55, got %d\n", erf.fError);
240 
241  FDIDestroy(hfdi);
242  }
243 
244  SetLastError(0xdeadbeef);
245  erf.erfOper = 0x1abe11ed;
246  erf.erfType = 0x5eed1e55;
247  erf.fError = 0x1ead1e55;
250  cpuUNKNOWN, &erf);
251  ok(hfdi != NULL, "Expected non-NULL context\n");
252  ok(GetLastError() == 0xdeadbeef,
253  "Expected 0xdeadbeef, got %d\n", GetLastError());
254  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
255  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
256  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
257 
258  FDIDestroy(hfdi);
259 
260  SetLastError(0xdeadbeef);
261  erf.erfOper = 0x1abe11ed;
262  erf.erfType = 0x5eed1e55;
263  erf.fError = 0x1ead1e55;
266  cpuUNKNOWN, &erf);
267  ok(hfdi != NULL, "Expected non-NULL context\n");
268  ok(GetLastError() == 0xdeadbeef,
269  "Expected 0xdeadbeef, got %d\n", GetLastError());
270  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
271  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
272  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
273 
274  FDIDestroy(hfdi);
275 
276  SetLastError(0xdeadbeef);
277  erf.erfOper = 0x1abe11ed;
278  erf.erfType = 0x5eed1e55;
279  erf.fError = 0x1ead1e55;
282  cpuUNKNOWN, &erf);
283  ok(hfdi != NULL, "Expected non-NULL context\n");
284  ok(GetLastError() == 0xdeadbeef,
285  "Expected 0xdeadbeef, got %d\n", GetLastError());
286  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
287  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
288  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
289 
290  FDIDestroy(hfdi);
291 
292  SetLastError(0xdeadbeef);
293  erf.erfOper = 0x1abe11ed;
294  erf.erfType = 0x5eed1e55;
295  erf.fError = 0x1ead1e55;
298  cpuUNKNOWN, &erf);
299  ok(hfdi != NULL, "Expected non-NULL context\n");
300  ok(GetLastError() == 0xdeadbeef,
301  "Expected 0xdeadbeef, got %d\n", GetLastError());
302  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
303  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
304  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
305 
306  FDIDestroy(hfdi);
307 
308  SetLastError(0xdeadbeef);
309  erf.erfOper = 0x1abe11ed;
310  erf.erfType = 0x5eed1e55;
311  erf.fError = 0x1ead1e55;
314  cpuUNKNOWN, &erf);
315  ok(hfdi != NULL, "Expected non-NULL context\n");
316  ok(GetLastError() == 0xdeadbeef,
317  "Expected 0xdeadbeef, got %d\n", GetLastError());
318  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
319  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
320  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
321 
322  FDIDestroy(hfdi);
323 
324  SetLastError(0xdeadbeef);
325  erf.erfOper = 0x1abe11ed;
326  erf.erfType = 0x5eed1e55;
327  erf.fError = 0x1ead1e55;
330  cpuUNKNOWN, NULL);
331  /* XP sets hfdi to a non-NULL value, but Vista sets it to NULL! */
332  ok(GetLastError() == 0xdeadbeef,
333  "Expected 0xdeadbeef, got %d\n", GetLastError());
334  /* NULL is passed to FDICreate instead of &erf, so don't retest the erf member values. */
335 
336  FDIDestroy(hfdi);
337 
338  /* bad cpu type */
339  SetLastError(0xdeadbeef);
340  erf.erfOper = 0x1abe11ed;
341  erf.erfType = 0x5eed1e55;
342  erf.fError = 0x1ead1e55;
345  0xcafebabe, &erf);
346  ok(hfdi != NULL, "Expected non-NULL context\n");
347  ok(GetLastError() == 0xdeadbeef,
348  "Expected 0xdeadbeef, got %d\n", GetLastError());
349  ok((erf.erfOper == 0x1abe11ed || erf.erfOper == 0 /* Vista */), "Expected 0x1abe11ed or 0, got %d\n", erf.erfOper);
350  ok((erf.erfType == 0x5eed1e55 || erf.erfType == 0 /* Vista */), "Expected 0x5eed1e55 or 0, got %d\n", erf.erfType);
351  ok((erf.fError == 0x1ead1e55 || erf.fError == 0 /* Vista */), "Expected 0x1ead1e55 or 0, got %d\n", erf.fError);
352 
353  FDIDestroy(hfdi);
354 
355  /* pfnalloc fails */
356  SetLastError(0xdeadbeef);
357  erf.erfOper = 0x1abe11ed;
358  erf.erfType = 0x5eed1e55;
359  erf.fError = 0x1ead1e55;
362  cpuUNKNOWN, &erf);
363  ok(hfdi == NULL, "Expected NULL context, got %p\n", hfdi);
364  ok(erf.erfOper == FDIERROR_ALLOC_FAIL,
365  "Expected FDIERROR_ALLOC_FAIL, got %d\n", erf.erfOper);
366  ok(erf.fError == TRUE, "Expected TRUE, got %d\n", erf.fError);
367  ok(GetLastError() == 0xdeadbeef,
368  "Expected 0xdeadbeef, got %d\n", GetLastError());
369  ok(erf.erfType == 0, "Expected 0, got %d\n", erf.erfType);
370 }
BOOL __cdecl FDIDestroy(HFDI hfdi)
Definition: fdi.c:2831
static UINT CDECL fdi_write(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:161
#define TRUE
Definition: types.h:120
static void CDECL fdi_free(void *pv)
Definition: fdi.c:137
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
Definition: fdi.c:142
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define cpuUNKNOWN
Definition: fdi.h:269
Definition: fci.h:44
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:170
double __cdecl erf(double)
#define SetLastError(x)
Definition: compat.h:417
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:152
#define ok(value,...)
Definition: atltest.h:57
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:176
static void *CDECL fdi_alloc_bad(ULONG cb)
Definition: fdi.c:132
static void *CDECL fdi_alloc(ULONG cb)
Definition: fdi.c:127

Referenced by START_TEST().

◆ test_FDIDestroy()

static void test_FDIDestroy ( void  )
static

Definition at line 372 of file fdi.c.

373 {
374  HFDI hfdi;
375  ERF erf;
376  BOOL ret;
377 
378  /* native crashes if hfdi is NULL or invalid */
379 
382  cpuUNKNOWN, &erf);
383  ok(hfdi != NULL, "Expected non-NULL context\n");
384 
385  /* successfully destroy hfdi */
386  ret = FDIDestroy(hfdi);
387  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
388 
389  /* native crashes if you try to destroy hfdi twice */
390  if (0)
391  {
392  /* try to destroy hfdi again */
393  ret = FDIDestroy(hfdi);
394  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
395  }
396 }
BOOL __cdecl FDIDestroy(HFDI hfdi)
Definition: fdi.c:2831
static UINT CDECL fdi_write(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:161
#define TRUE
Definition: types.h:120
static void CDECL fdi_free(void *pv)
Definition: fdi.c:137
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
Definition: fdi.c:142
#define cpuUNKNOWN
Definition: fdi.h:269
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: fci.h:44
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:170
double __cdecl erf(double)
int ret
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:152
#define ok(value,...)
Definition: atltest.h:57
static LONG CDECL fdi_seek(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:176
static void *CDECL fdi_alloc(ULONG cb)
Definition: fdi.c:127

Referenced by START_TEST().

◆ test_FDIIsCabinet()

static void test_FDIIsCabinet ( void  )
static

Definition at line 645 of file fdi.c.

646 {
647  ERF erf;
648  BOOL ret;
649  HFDI hfdi;
650  INT_PTR fd;
651  FDICABINETINFO cabinfo;
652  char temp[] = "temp.txt";
653  char extract[] = "extract.cab";
654 
656  create_cab_file();
657 
660  cpuUNKNOWN, &erf);
661  ok(hfdi != NULL, "Expected non-NULL context\n");
662 
663  /* native crashes if hfdi or cabinfo are NULL or invalid */
664 
665  /* invalid file handle */
666  ZeroMemory(&cabinfo, sizeof(FDICABINETINFO));
667  SetLastError(0xdeadbeef);
668  ret = FDIIsCabinet(hfdi, -1, &cabinfo);
669  ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
671  "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError());
672  ok(cabinfo.cbCabinet == 0, "Expected 0, got %d\n", cabinfo.cbCabinet);
673  ok(cabinfo.cFiles == 0, "Expected 0, got %d\n", cabinfo.cFiles);
674  ok(cabinfo.cFolders == 0, "Expected 0, got %d\n", cabinfo.cFolders);
675  ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
676  ok(cabinfo.setID == 0, "Expected 0, got %d\n", cabinfo.setID);
677 
678  createTestFile("temp.txt");
679  fd = fdi_open(temp, 0, 0);
680 
681  /* file handle doesn't point to a cabinet */
682  ZeroMemory(&cabinfo, sizeof(FDICABINETINFO));
683  SetLastError(0xdeadbeef);
684  ret = FDIIsCabinet(hfdi, fd, &cabinfo);
685  ok(ret == FALSE, "Expected FALSE, got %d\n", ret);
686  ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
687  ok(cabinfo.cbCabinet == 0, "Expected 0, got %d\n", cabinfo.cbCabinet);
688  ok(cabinfo.cFiles == 0, "Expected 0, got %d\n", cabinfo.cFiles);
689  ok(cabinfo.cFolders == 0, "Expected 0, got %d\n", cabinfo.cFolders);
690  ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
691  ok(cabinfo.setID == 0, "Expected 0, got %d\n", cabinfo.setID);
692 
693  fdi_close(fd);
694  DeleteFileA("temp.txt");
695 
696  /* try a real cab */
697  fd = fdi_open(extract, 0, 0);
698  ZeroMemory(&cabinfo, sizeof(FDICABINETINFO));
699  SetLastError(0xdeadbeef);
700  ret = FDIIsCabinet(hfdi, fd, &cabinfo);
701  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
702  ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
703  ok(cabinfo.cFiles == 4, "Expected 4, got %d\n", cabinfo.cFiles);
704  ok(cabinfo.cFolders == 1, "Expected 1, got %d\n", cabinfo.cFolders);
705  ok(cabinfo.setID == 0xbeef, "Expected 0xbeef, got %d\n", cabinfo.setID);
706  ok(cabinfo.cbCabinet == 182, "Expected 182, got %d\n", cabinfo.cbCabinet);
707  ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
708 
709  fdi_close(fd);
710  FDIDestroy(hfdi);
711 
714  cpuUNKNOWN, &erf);
715  ok(hfdi != NULL, "Expected non-NULL context\n");
716 
717  /* FDIIsCabinet accepts hf == 0 even though it's not a valid result of pfnopen */
719  ZeroMemory(&cabinfo, sizeof(FDICABINETINFO));
720  SetLastError(0xdeadbeef);
721  ret = FDIIsCabinet(hfdi, 0, &cabinfo);
722  ok(ret == TRUE, "Expected TRUE, got %d\n", ret);
723  ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError());
724  ok(cabinfo.cFiles == 4, "Expected 4, got %d\n", cabinfo.cFiles);
725  ok(cabinfo.cFolders == 1, "Expected 1, got %d\n", cabinfo.cFolders);
726  ok(cabinfo.setID == 0xbeef, "Expected 0xbeef, got %d\n", cabinfo.setID);
727  ok(cabinfo.cbCabinet == 182, "Expected 182, got %d\n", cabinfo.cbCabinet);
728  ok(cabinfo.iCabinet == 0, "Expected 0, got %d\n", cabinfo.iCabinet);
729 
731  FDIDestroy(hfdi);
732 
734 }
static INT_PTR CDECL fdi_open_static(char *pszFile, int oflag, int pmode)
Definition: fdi.c:185
BOOL __cdecl FDIDestroy(HFDI hfdi)
Definition: fdi.c:2831
static UINT CDECL fdi_write(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:161
#define TRUE
Definition: types.h:120
static void CDECL fdi_free(void *pv)
Definition: fdi.c:137
USHORT setID
Definition: fdi.h:149
static INT_PTR CDECL fdi_open(char *pszFile, int oflag, int pmode)
Definition: fdi.c:142
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:1642
static int fd
Definition: io.c:51
static UINT CDECL fdi_read_static(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:191
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:614
USHORT cFiles
Definition: fdi.h:148
#define cpuUNKNOWN
Definition: fdi.h:269
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: fci.h:44
static LONG CDECL fdi_seek_static(INT_PTR hf, LONG dist, int seektype)
Definition: fdi.c:209
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:398
static UINT CDECL fdi_write_static(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:197
static int CDECL fdi_close(INT_PTR hf)
Definition: fdi.c:170
double __cdecl erf(double)
#define SetLastError(x)
Definition: compat.h:417
int ret
static UINT CDECL fdi_read(INT_PTR hf, void *pv, UINT cb)
Definition: fdi.c:152
static void delete_test_files(void)
Definition: fdi.c:426
static calc_node_t temp
Definition: rpn_ieee.c:38
#define ok(value,...)
Definition: atltest.h:57
static void create_test_files(void)
Definition: fdi.c:410
static INT_PTR static_fdi_handle
Definition: fdi.c:183
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:176
static int CDECL fdi_close_static(INT_PTR hf)
Definition: fdi.c:203
static void *CDECL fdi_alloc(ULONG cb)
Definition: fdi.c:127

Referenced by START_TEST().

Variable Documentation

◆ ab

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

Definition at line 106 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 34 of file fdi.c.

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

◆ data

Definition at line 105 of file fdi.c.

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

◆ file

Definition at line 103 of file fdi.c.

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

◆ folder

◆ header

Definition at line 101 of file fdi.c.

Referenced by add_cookie_headers(), add_request_headers(), AllocateDictionaryEntry(), 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_set_size(), CDataEncodeMsg_Update(), CdRomGetConfiguration(), CdRompPrintAllFeaturePages(), check_iml_data(), check_storage_contents(), CheckSumMappedFile(), ClasspInitializeGesn(), clnt_cb_thread(), commit_cache_entry(), convert_dib_to_bmp(), d3drm3_Load(), d3drm_mesh_builder3_Load(), d3drm_texture_load(), BtrfsRecv::do_recv(), EmitREBytecode(), empty_header_list(), EnumColorProfilesA(), EnumColorProfilesW(), ext4_xattr_entry_data(), find_prop(), FreeDictionaryEntry(), FreeUrlCacheSpaceW(), GdipCreateMetafileFromEmf(), get_channel_http_header(), get_cookie_header(), get_first_last_from_cmap(), get_host_header(), get_ndr_types_params(), get_subtests(), get_ttf_nametable_entry(), GetColorProfileFromHandle(), getConvertedFrameAndBounds(), header_state(), HTMLXMLHttpRequest_getResponseHeader(), ID3DXFontImpl_DrawTextW(), IDirectMusicBufferImpl_PackStructured(), IDirectMusicBufferImpl_PackUnstructured(), insert_authorization_header(), is_win_xp(), load_mf_pict(), load_ole_stream(), load_ttf_name_id(), Marshal_ReleaseMarshalData(), METAFILE_GraphicsDeleted(), METAFILE_WriteHeader(), MimeBody_GetParameters(), MimeBody_GetProp(), MimeBody_GetPropInfo(), MimeBody_SetProp(), nls_from_txt(), nsChannel_IsNoStoreResponse(), OnNotifySettingsPage(), parse_header(), parse_headers(), parse_pres_streams(), pass(), PATH_add_outline(), process_response_status_text(), read_msft_importlib(), read_reply(), REBAR_ValidateBand(), RPCRT4_BuildAuthHeader(), RPCRT4_BuildBindAckHeader(), RPCRT4_BuildBindHeader(), RPCRT4_BuildBindNackHeader(), RPCRT4_BuildFaultHeader(), RPCRT4_BuildHttpConnectHeader(), RPCRT4_BuildHttpFlowControlHeader(), RPCRT4_BuildHttpHeader(), RPCRT4_BuildRequestHeader(), RPCRT4_BuildResponseHeader(), save_dds_surface_to_memory(), save_dib(), save_emf(), save_mfpict(), save_view_cache(), scan_revoke_records(), send_subvol(), set_http_header(), set_input_fragment(), set_profile_device_key(), set_window(), sltg_write_header(), START_TEST(), synthesize_dib(), SystemApplet(), test_chunked_read(), test_columns(), test_columnscreation(), test_createfromwmf(), 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_proc(), test_ICSeqCompress(), test_imagelists(), test_loadwmf(), test_LVS_EX_HEADERINALLVIEWS(), test_nosortheader(), test_notifyformat(), test_OleLoad(), test_olestream(), test_pic(), test_rc2_keylen(), test_SetColorProfileHeader(), test_wmreader_interfaces(), test_wmsyncreader_interfaces(), test_wmwriter_interfaces(), TestClassRedirection(), BtrfsSend::Thread(), tt_face_get_metrics(), tt_face_load_generic_header(), tt_face_load_hhea(), unfold_header(), urlcache_create_hash_table(), urlcache_entry_commit(), urlcache_entry_create(), urlcache_entry_get_file(), urlcache_get_entry_info(), VARIANT_UserMarshal(), VARIANT_UserUnmarshal(), visit_http_headers(), write_header(), and zipRemoveExtraInfoBlock().

◆ static_fdi_handle

INT_PTR static_fdi_handle
static

Definition at line 183 of file fdi.c.

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

◆ szName

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

Definition at line 104 of file fdi.c.