1 rizwank 1.1 /*
2 * Unit test suite for cabinet.dll - FDI functions
3 *
4 * Copyright 2004 Rizwan Kassim, Dan Kegel
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21
22 rizwank 1.1 #include <stdlib.h>
23
24 #ifndef STANDALONE
25 #include <wine/test.h>
26 #define ok2 ok
27 #else
28 /* To build outside Wine tree, compile with cl -DSTANDALONE -D_X86_ cabinet_fdi.c FDI.lib
29 These are only called if standalone are used, defining ok and START_TEST, which would normally be declared in winetree */
30 #include <assert.h>
31 #include <stdio.h>
32 #define START_TEST(name) main(int argc, char **argv)
33 #define ok(condition, msg) \
34 do { if(!(condition)) { \
35 fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__); \
36 exit(1); \
37 } } while(0)
38 #define ok2(condition, msg, arg) \
39 do { if(!(condition)) { \
40 fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__, arg); \
41 exit(1); \
42 } } while(0)
43 rizwank 1.1 #define todo_wine
44 #endif
45
46
47 #include <winerror.h>
48 #include <fdi.h>
49
50 /* To do in FDI: -from wine/include/fdi.h
51 FDICreate
52 Memory Allocation -FNALLOC(cb)
53 Memory Free -FNFREE(pv)
54 File Open -FNOPEN(pszFile,oflag,pmode)
55 File Read -FNREAD(hf, pv, cb)
56 File Write -FNWRITE(hf, pv, cb)
57 File Close -FNCLOSE(hf)
58 File Seek -FNSEEK(hf,dist,seektype)
59 Error Structure
60 FDIlsCabinet
61 FDICabinetInfo Structure
62 FDICopy
63 Notification function
64 rizwank 1.1 Decryption function
65 FDIDestroy
66 */
67
|
70 rizwank 1.3 FNALLOC(dummy_alloc) {
71 printf("FNALLOC just called with %d\n",cb);
72 return 0;
73 }
74
75 FNFREE(dummy_free) {
76 printf("FNFREE just called with %d\n",pv);
77 return;
78 }
79
80 FNOPEN(dummy_open) {
81 printf("FNOPEN just called with %d, %d, %d\n",pszFile, oflag, pmode);
82 return 0;
83 }
84
85 FNREAD(dummy_read) {
86 /* printf("FNREAD just called with %d, %d, %d\n",hf, pv, cb);
87 return void;
88 */ return 0;
89 }
90
91 rizwank 1.3 FNWRITE(dummy_write) {
92 /* printf("FNWRITE just called with %d, %d, %d\n",hf, pv, cb);
93 return void;
94 */ return 0;
95 }
96
97
98 FNCLOSE(dummy_close) {
99 /* printf("FNCLOSE just called with %d\n",hf);
100 return void;
101 */ return 0;
102 }
|
104 rizwank 1.3 FNSEEK(dummy_seek) {
105 /* printf("FNSEEK just called with %d, %d, %d\n",hf, dist, seektype);
106 return void;
107 */ return 0;
108 }
109
|
125 rizwank 1.4 static void TestCreate(void) {
126
127 ERF error_structure;
128
129 printf("Starting TestCreate()\n");
130
131 my_hfdi = FDICreate(
132 dummy_alloc,
133 dummy_free,
134 dummy_open,
135 dummy_read,
136 dummy_write,
137 dummy_close,
138 dummy_seek,
139 cpu80386,
140 &error_structure
141 );
142
143 ok(my_hfdi != NULL,"FDICreate failed!\n");
144
145 printf("Ending TestCreate()\n");
146 rizwank 1.4 }
|