source: trunk/src/kernel32/Fileio.cpp@ 2802

Last change on this file since 2802 was 2802, checked in by sandervl, 26 years ago

Added new logging feature

File size: 28.9 KB
Line 
1/* $Id: Fileio.cpp,v 1.24 2000-02-16 14:25:29 sandervl Exp $ */
2
3/*
4 * Win32 File IO API functions for OS/2
5 *
6 * Copyright 1998 Sander van Leeuwen
7 * Copyright 1998 Patrick Haller
8 *
9 *
10 * Project Odin Software License can be found in LICENSE.TXT
11 *
12 */
13
14
15/*****************************************************************************
16 * Includes *
17 *****************************************************************************/
18
19#include <odin.h>
20#include <odinwrap.h>
21#include <os2sel.h>
22
23#include <os2win.h>
24#include <stdlib.h>
25#include <string.h>
26#include "unicode.h"
27#include <heapstring.h>
28#include "handlemanager.h"
29#include "oslibdos.h"
30
31#define DBG_LOCALLOG DBG_fileio
32#include "dbglocal.h"
33
34ODINDEBUGCHANNEL(KERNEL32-FILEIO)
35
36//******************************************************************************
37//******************************************************************************
38ODINFUNCTION7(HFILE, CreateFileA,
39 LPCSTR, lpszName,
40 DWORD, fdwAccess,
41 DWORD, fdwShareMode,
42 LPSECURITY_ATTRIBUTES, lpsa,
43 DWORD, fdwCreate,
44 DWORD, fdwAttrsAndFlags,
45 HANDLE, hTemplateFile)
46{
47 dprintf(("CreateFileA %s", lpszName));
48 return(HMCreateFile(lpszName,
49 fdwAccess,
50 fdwShareMode,
51 lpsa,
52 fdwCreate,
53 fdwAttrsAndFlags,
54 hTemplateFile));
55}
56
57//******************************************************************************
58//******************************************************************************
59ODINFUNCTION7(HFILE, CreateFileW,
60 LPCWSTR, arg1,
61 DWORD, arg2,
62 DWORD, arg3,
63 PSECURITY_ATTRIBUTES, arg4,
64 DWORD, arg5,
65 DWORD, arg6,
66 HANDLE, arg7)
67{
68 HANDLE rc;
69 char *astring;
70
71 astring = UnicodeToAsciiString((LPWSTR)arg1);
72 rc = CreateFileA(astring, arg2, arg3, arg4, arg5, arg6, arg7);
73 FreeAsciiString(astring);
74 return(rc);
75}
76//******************************************************************************
77//******************************************************************************
78ODINFUNCTION2(HANDLE, FindFirstFileA,
79 LPCSTR, arg1,
80 WIN32_FIND_DATAA *, arg2)
81{
82 dprintf(("FindFirstFileA %s", arg1));
83 return O32_FindFirstFile(arg1, arg2);
84}
85
86//******************************************************************************
87//******************************************************************************
88ODINFUNCTION2(HANDLE, FindFirstFileW,
89 LPCWSTR, arg1,
90 WIN32_FIND_DATAW *, arg2)
91{
92 HANDLE rc;
93 char *astring;
94 WIN32_FIND_DATAA wfda;
95
96 astring = UnicodeToAsciiString((LPWSTR)arg1);
97 rc = FindFirstFileA(astring, &wfda);
98
99 if(rc == -1) {
100 memset(arg2, 0, sizeof(WIN32_FIND_DATAW));
101 }
102 else {
103 // convert back the result structure
104 memcpy(arg2,
105 &wfda,
106 sizeof(WIN32_FIND_DATAA));
107
108 lstrcpynAtoW (arg2->cFileName,
109 wfda.cFileName,
110 sizeof(wfda.cFileName));
111
112 lstrcpynAtoW (arg2->cAlternateFileName,
113 wfda.cAlternateFileName,
114 sizeof(wfda.cAlternateFileName));
115 }
116 FreeAsciiString(astring);
117 return(rc);
118}
119//******************************************************************************
120//******************************************************************************
121ODINFUNCTION2(BOOL, FindNextFileA,
122 HANDLE, arg1,
123 WIN32_FIND_DATAA *, arg2)
124{
125 return O32_FindNextFile(arg1, arg2);
126}
127//******************************************************************************
128//******************************************************************************
129ODINFUNCTION2(BOOL, FindNextFileW,
130 HANDLE, arg1,
131 WIN32_FIND_DATAW *, arg2)
132{
133 WIN32_FIND_DATAA wfda;
134 BOOL rc;
135
136 rc = FindNextFileA(arg1, &wfda);
137
138 if(rc == 0) {
139 memset(arg2, 0, sizeof(WIN32_FIND_DATAW));
140 }
141 else {
142 // convert back the result structure
143 memcpy(arg2,
144 &wfda,
145 sizeof(WIN32_FIND_DATAA));
146
147 lstrcpynAtoW (arg2->cFileName,
148 wfda.cFileName,
149 sizeof(wfda.cFileName));
150
151 lstrcpynAtoW (arg2->cAlternateFileName,
152 wfda.cAlternateFileName,
153 sizeof(wfda.cAlternateFileName));
154 }
155 return rc;
156}
157//******************************************************************************
158//******************************************************************************
159ODINFUNCTION1(BOOL, FindClose,
160 HANDLE, arg1)
161{
162 return O32_FindClose(arg1);
163}
164//******************************************************************************
165//******************************************************************************
166ODINFUNCTION1(DWORD, GetFileType,
167 HANDLE, hFile)
168{
169 return(HMGetFileType(hFile));
170}
171//******************************************************************************
172//******************************************************************************
173ODINFUNCTION2(DWORD, GetFileInformationByHandle,
174 HANDLE, arg1,
175 BY_HANDLE_FILE_INFORMATION *, arg2)
176{
177 return(HMGetFileInformationByHandle(arg1,arg2));
178}
179//******************************************************************************
180//******************************************************************************
181ODINFUNCTION1(BOOL, SetEndOfFile,
182 HANDLE, arg1)
183{
184 return HMSetEndOfFile(arg1);
185}
186//******************************************************************************
187//******************************************************************************
188ODINFUNCTION4(BOOL, SetFileTime,
189 HANDLE, arg1,
190 const FILETIME *, arg2,
191 const FILETIME *, arg3,
192 const FILETIME *, arg4)
193{
194 return HMSetFileTime(arg1,
195 arg2,
196 arg3,
197 arg4);
198}
199//******************************************************************************
200//******************************************************************************
201ODINFUNCTION2(INT, CompareFileTime,
202 FILETIME *, arg1,
203 FILETIME *, arg2)
204{
205 return O32_CompareFileTime(arg1, arg2);
206}
207//******************************************************************************
208//******************************************************************************
209ODINFUNCTION3(BOOL, CopyFileA,
210 LPCSTR, arg1,
211 LPCSTR, arg2,
212 BOOL, arg3)
213{
214 return O32_CopyFile(arg1, arg2, arg3);
215}
216//******************************************************************************
217//SvL: 24-6-'97 - Added
218//******************************************************************************
219ODINFUNCTION3(BOOL, CopyFileW,
220 LPCWSTR, arg1,
221 LPCWSTR, arg2,
222 BOOL, arg3)
223{
224 BOOL rc;
225 char *astring1, *astring2;
226
227 astring1 = UnicodeToAsciiString((LPWSTR)arg1);
228 astring2 = UnicodeToAsciiString((LPWSTR)arg2);
229 rc = O32_CopyFile(astring1, astring2, arg3);
230 FreeAsciiString(astring2);
231 FreeAsciiString(astring1);
232 return(rc);
233}
234//******************************************************************************
235//******************************************************************************
236ODINFUNCTION2(DWORD, GetFileSize,
237 HANDLE, arg1,
238 PDWORD, arg2)
239{
240 return HMGetFileSize(arg1,
241 arg2);
242}
243//******************************************************************************
244//******************************************************************************
245ODINFUNCTION1(BOOL, DeleteFileA,
246 LPCSTR, lpszFile)
247{
248 dprintf(("DeleteFileA %s", lpszFile));
249 return O32_DeleteFile(lpszFile);
250}
251//******************************************************************************
252//******************************************************************************
253ODINFUNCTION1(BOOL, DeleteFileW,
254 LPCWSTR, arg1)
255{
256 BOOL rc;
257 char *astring;
258
259 astring = UnicodeToAsciiString((LPWSTR)arg1);
260 rc = ODIN_DeleteFileA(astring);
261 FreeAsciiString(astring);
262 return(rc);
263}
264//******************************************************************************
265//******************************************************************************
266ODINFUNCTION4(UINT, GetTempFileNameA,
267 LPCSTR, arg1,
268 LPCSTR, arg2,
269 UINT, arg3,
270 LPSTR, arg4)
271{
272 return O32_GetTempFileName(arg1, arg2, arg3, arg4);
273}
274//******************************************************************************
275//******************************************************************************
276ODINFUNCTION4(UINT, GetTempFileNameW,
277 LPCWSTR, lpPathName,
278 LPCWSTR, lpPrefixString,
279 UINT, uUnique,
280 LPWSTR, lpTempFileName)
281{
282 char *asciipath, *asciiprefix;
283 char *asciitemp = (char *)malloc(MAX_PATH+1);
284 UINT rc;
285
286 asciipath = UnicodeToAsciiString((LPWSTR)lpPathName);
287 asciiprefix = UnicodeToAsciiString((LPWSTR)lpPrefixString);
288 rc = O32_GetTempFileName(asciipath, asciiprefix, uUnique, asciitemp);
289 if(rc) AsciiToUnicode(asciitemp, lpTempFileName);
290 FreeAsciiString(asciiprefix);
291 FreeAsciiString(asciipath);
292 free(asciitemp);
293 return(rc);
294}
295//******************************************************************************
296//******************************************************************************
297ODINFUNCTION2(UINT, GetTempPathA,
298 UINT, arg1,
299 LPSTR, arg2)
300{
301 return O32_GetTempPath(arg1, arg2);
302}
303//******************************************************************************
304//******************************************************************************
305ODINFUNCTION2(UINT, GetTempPathW,
306 UINT, nBufferLength,
307 LPWSTR, lpBuffer)
308{
309 char *asciibuffer = (char *)malloc(nBufferLength+1);
310 DWORD rc;
311
312 rc = O32_GetTempPath(nBufferLength, asciibuffer);
313 if(rc) AsciiToUnicode(asciibuffer, lpBuffer);
314 free(asciibuffer);
315 return(rc);
316}
317//******************************************************************************
318//******************************************************************************
319ODINFUNCTION5(BOOL, ReadFile,
320 HANDLE, hFile,
321 PVOID, pBuffer,
322 DWORD, dwLength,
323 PDWORD, lpNumberOfBytesRead,
324 LPOVERLAPPED, lpOverlapped)
325{
326 return (HMReadFile(hFile,
327 pBuffer,
328 dwLength,
329 lpNumberOfBytesRead,
330 lpOverlapped));
331}
332//******************************************************************************
333//******************************************************************************
334ODINFUNCTION4(DWORD, SetFilePointer,
335 HANDLE, hFile,
336 LONG, lDistanceToMove,
337 PLONG, lpDistanceToMoveHigh,
338 DWORD, dwMoveMethod)
339{
340 dprintf(("KERNEL32: SetFilePointer(%08xh,%08xh,%08xh,%08xh)\n",
341 hFile,
342 lDistanceToMove,
343 lpDistanceToMoveHigh,
344 dwMoveMethod));
345
346 return(HMSetFilePointer(hFile,
347 lDistanceToMove,
348 lpDistanceToMoveHigh,
349 dwMoveMethod));
350}
351//******************************************************************************
352//******************************************************************************
353ODINFUNCTION5(BOOL, WriteFile,
354 HANDLE, hFile,
355 LPCVOID, buffer,
356 DWORD, nrbytes,
357 LPDWORD, nrbyteswritten,
358 LPOVERLAPPED, lpOverlapped)
359{
360 dprintf(("KERNEL32: WriteFile(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
361 hFile,
362 buffer,
363 nrbytes,
364 nrbyteswritten,
365 lpOverlapped));
366
367 return (HMWriteFile(hFile,
368 buffer,
369 nrbytes,
370 nrbyteswritten,
371 lpOverlapped));
372}
373//******************************************************************************
374//******************************************************************************
375ODINFUNCTION1(DWORD, GetFileAttributesA,
376 LPCSTR, lpszFileName)
377{
378 DWORD rc, error;
379
380 rc = O32_GetFileAttributes((LPSTR)lpszFileName);
381#if 0 // need more tests, maybe there is also a better way to hide simulated b:
382 if(rc == -1 && lpszFileName != NULL && !strnicmp(lpszFileName, "B:", 2))
383 {
384 error = GetLastError();
385 if(error = ERROR_DISK_CHANGE)
386 SetLastError(ERROR_NOT_READY);
387 else
388 SetLastError(error);
389 }
390#endif
391 dprintf(("KERNEL32: GetFileAttributes of %s returned %d\n", lpszFileName, rc));
392 return(rc);
393}
394//******************************************************************************
395//******************************************************************************
396ODINFUNCTION1(DWORD, GetFileAttributesW,
397 LPCWSTR, arg1)
398{
399 DWORD rc;
400 char *astring;
401
402 dprintf(("KERNEL32: GetFileAttributesW\n"));
403 astring = UnicodeToAsciiString((LPWSTR)arg1);
404 rc = ODIN_GetFileAttributesA(astring);
405 FreeAsciiString(astring);
406 return(rc);
407}
408//******************************************************************************
409//******************************************************************************
410ODINFUNCTION2(BOOL, SetFileAttributesA,
411 LPCSTR, arg1,
412 DWORD, arg2)
413{
414 dprintf(("KERNEL32: SetFileAttributes of %s\n", arg1));
415 return O32_SetFileAttributes(arg1, arg2);
416}
417//******************************************************************************
418//******************************************************************************
419ODINFUNCTION2(BOOL, SetFileAttributesW,
420 LPCWSTR, lpFileName,
421 DWORD, dwFileAttributes)
422{
423 char *asciifile;
424 BOOL rc;
425
426 dprintf(("KERNEL32: SetFileAttributesW\n"));
427 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
428 rc = O32_SetFileAttributes(asciifile, dwFileAttributes);
429 FreeAsciiString(asciifile);
430 return(rc);
431}
432//******************************************************************************
433//******************************************************************************
434ODINFUNCTION4(DWORD, GetFullPathNameA,
435 LPCSTR, arg1,
436 DWORD, arg2,
437 LPSTR, arg3,
438 LPSTR *, arg4)
439{
440 char *ptr;
441 dprintf(("KERNEL32: GetFullPathName %s\n", arg1));
442 while((ptr = strchr(arg1, '/')) != NULL)
443 *ptr = '\\';
444 return O32_GetFullPathName(arg1, arg2, arg3, arg4);
445}
446//******************************************************************************
447//******************************************************************************
448ODINFUNCTION4(DWORD, GetFullPathNameW,
449 LPCWSTR, lpFileName,
450 DWORD, nBufferLength,
451 LPWSTR, lpBuffer,
452 LPWSTR *, lpFilePart)
453{
454 char *astring, *asciibuffer, *asciipart;
455 DWORD rc;
456
457 asciibuffer = (char *)malloc(nBufferLength+1);
458 astring = UnicodeToAsciiString((LPWSTR)lpFileName);
459
460 rc = ODIN_GetFullPathNameA(astring,
461 nBufferLength,
462 asciibuffer,
463 &asciipart);
464
465 dprintf(("KERNEL32: GetFullPathNameW %s returns %s\n",
466 astring,
467 asciibuffer));
468
469 if(rc)
470 AsciiToUnicode(asciibuffer,
471 lpBuffer);
472
473 if(lpFilePart)
474 *lpFilePart = lpBuffer + ((int)asciipart - (int)asciibuffer);
475
476 FreeAsciiString(astring);
477 free(asciibuffer);
478 return(rc);
479}
480//******************************************************************************
481//******************************************************************************
482ODINFUNCTION5(BOOL, LockFile,
483 HANDLE, arg1,
484 DWORD, arg2,
485 DWORD, arg3,
486 DWORD, arg4,
487 DWORD, arg5)
488{
489 dprintf(("KERNEL32: LockFile (%08xh,%08xh,%08xh,%08xh,%08xh)\n",
490 arg1,
491 arg2,
492 arg3,
493 arg4,
494 arg5));
495
496 return HMLockFile(arg1,
497 arg2,
498 arg3,
499 arg4,
500 arg5);
501}
502
503
504/*****************************************************************************
505 * Name : BOOL LockFileEx
506 * Purpose : The LockFileEx function locks a byte range within an open file for shared or exclusive access.
507 * Parameters: HANDLE hFile handle of file to lock
508 * DWORD dwFlags functional behavior modification flags
509 * DWORD dwReserved reserved, must be set to zero
510 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
511 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
512 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
513 * Variables :
514 * Result : TRUE / FALSE
515 * Remark :
516 * Status : UNTESTED STUB
517 *
518 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
519 *****************************************************************************/
520
521ODINFUNCTION6(BOOL, LockFileEx,
522 HANDLE, hFile,
523 DWORD, dwFlags,
524 DWORD, dwReserved,
525 DWORD, nNumberOfBytesToLockLow,
526 DWORD, nNumberOfBytesToLockHigh,
527 LPOVERLAPPED, lpOverlapped)
528{
529 dprintf(("Kernel32: LockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
530 hFile,
531 dwFlags,
532 dwReserved,
533 nNumberOfBytesToLockLow,
534 nNumberOfBytesToLockHigh,
535 lpOverlapped));
536
537 return(HMLockFile(hFile,
538 lpOverlapped->Offset,
539 lpOverlapped->OffsetHigh,
540 nNumberOfBytesToLockLow,
541 nNumberOfBytesToLockHigh));
542}
543
544
545
546
547//******************************************************************************
548//******************************************************************************
549ODINFUNCTION2(BOOL, MoveFileA,
550 LPCSTR, arg1,
551 LPCSTR, arg2)
552{
553 dprintf(("KERNEL32: MoveFileA %s %s", arg1, arg2));
554 return O32_MoveFile(arg1, arg2);
555}
556//******************************************************************************
557//******************************************************************************
558ODINFUNCTION3(BOOL, MoveFileExA,
559 LPCSTR, arg1,
560 LPCSTR, arg2,
561 DWORD, fdwFlags)
562{
563 dprintf(("KERNEL32: MoveFileExA %s to %s, not complete!\n", arg1, arg2));
564 return O32_MoveFile(arg1, arg2);
565}
566//******************************************************************************
567//******************************************************************************
568ODINFUNCTION2(BOOL, MoveFileW,
569 LPCWSTR, lpSrc,
570 LPCWSTR, lpDest)
571{
572 char *asciisrc, *asciidest;
573 BOOL rc;
574
575 dprintf(("KERNEL32: MoveFileW\n"));
576 asciisrc = UnicodeToAsciiString((LPWSTR)lpSrc);
577 asciidest = UnicodeToAsciiString((LPWSTR)lpDest);
578 rc = O32_MoveFile(asciisrc, asciidest);
579 FreeAsciiString(asciisrc);
580 FreeAsciiString(asciidest);
581 return(rc);
582}
583//******************************************************************************
584//******************************************************************************
585ODINFUNCTION3(BOOL, MoveFileExW,
586 LPCWSTR, arg1,
587 LPCWSTR, arg2,
588 DWORD, fdwFlags)
589{
590 dprintf(("KERNEL32: MoveFileExW %s to %s, not complete!\n", arg1, arg2));
591 return MoveFileW(arg1, arg2);
592}
593//******************************************************************************
594/*****************************************************************************
595ODINFUNCTION3(*, :,
596 HFILE, WIN32API,
597 OpenFile *, Purpose,
598 :, forwardOpenFile to Open32
599 * Parameters:
600 * Variables :
601 * Result : API returncode
602 * Remark : modified for handle translation support
603 * Status : @@@PH verify if 0 is a valid "invalid handle" :)
604 *
605 * Author : Patrick Haller [Fri, 1998/06/12 02:53]
606 *****************************************************************************/
607
608ODINFUNCTION3(HFILE, OpenFile,
609 LPCSTR, arg1,
610 OFSTRUCT *, arg2,
611 UINT, arg3)
612{
613 HFILE hFile;
614
615 dprintf(("KERNEL32: OpenFile(%s, %08xh, %08xh)\n",
616 arg1,
617 arg2,
618 arg3));
619
620 hFile = HMOpenFile(arg1, /* call open32 */
621 arg2,
622 arg3);
623
624 return (hFile);
625}
626//******************************************************************************
627//******************************************************************************
628ODINFUNCTION5(BOOL, UnlockFile,
629 HANDLE, arg1,
630 DWORD, arg2,
631 DWORD, arg3,
632 DWORD, arg4,
633 DWORD, arg5)
634{
635 dprintf(("KERNEL32: UnlockFile(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
636 arg1,
637 arg2,
638 arg3,
639 arg4,
640 arg5));
641
642 return HMUnlockFile(arg1,
643 arg2,
644 arg3,
645 arg4,
646 arg5);
647}
648
649
650/*****************************************************************************
651 * Name : BOOL UnlockFileEx
652 * Purpose : The UnlockFileEx function unlocks a previously locked byte range in an open file.
653 * Parameters: HANDLE hFile handle of file to lock
654 * DWORD dwReserved reserved, must be set to zero
655 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
656 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
657 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
658 * Variables :
659 * Result : TRUE / FALSE
660 * Remark :
661 * Status : UNTESTED STUB
662 *
663 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
664 *****************************************************************************/
665
666ODINFUNCTION5(BOOL, UnlockFileEx,
667 HANDLE, hFile,
668 DWORD, dwReserved,
669 DWORD, nNumberOfBytesToLockLow,
670 DWORD, nNumberOfBytesToLockHigh,
671 LPOVERLAPPED, lpOverlapped)
672{
673 dprintf(("Kernel32: UnlockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
674 hFile,
675 dwReserved,
676 nNumberOfBytesToLockLow,
677 nNumberOfBytesToLockHigh,
678 lpOverlapped));
679
680 return(HMUnlockFile(hFile,
681 lpOverlapped->Offset,
682 lpOverlapped->OffsetHigh,
683 nNumberOfBytesToLockLow,
684 nNumberOfBytesToLockHigh));
685}
686//******************************************************************************
687//******************************************************************************
688ODINFUNCTION3(DWORD, GetShortPathNameA,
689 LPCTSTR, lpszLongPath,
690 LPTSTR, lpszShortPath,
691 DWORD, cchBuffer)
692{
693 int length;
694
695 dprintf(("KERNEL32: GetShortPathNameA of %s, just copying it\n", lpszLongPath));
696 length = strlen(lpszLongPath) + 1;
697 if(length > cchBuffer) {
698 *lpszShortPath = 0;
699 return(length);
700 }
701 memcpy(lpszShortPath, lpszLongPath, length);
702 return(length-1);
703}
704//******************************************************************************
705//******************************************************************************
706ODINFUNCTION3(DWORD, GetShortPathNameW,
707 LPCWSTR, lpszLongPath,
708 LPWSTR, lpszShortPath,
709 DWORD, cchBuffer)
710{
711 int length;
712
713 dprintf(("KERNEL32: GetShortPathNameW; just copying it\n"));
714 length = UniStrlen((UniChar*)lpszLongPath) + 1;
715 if(length > cchBuffer) {
716 *lpszShortPath = 0;
717 return(length);
718 }
719 memcpy(lpszShortPath, lpszLongPath, length*sizeof(USHORT));
720 return(length-1);
721}
722//******************************************************************************
723//******************************************************************************
724ODINFUNCTION3(HANDLE, FindFirstChangeNotificationA,
725 LPCSTR, lpPathName,
726 BOOL, bWatchSubtree,
727 DWORD, dwNotifyFilter)
728{
729 dprintf(("KERNEL32: FindFirstChangeNotificationA, Not implemented\n"));
730 return(0);
731}
732//******************************************************************************
733//******************************************************************************
734ODINFUNCTION1(BOOL, FindNextChangeNotification,
735 HANDLE, hChange)
736{
737 dprintf(("KERNEL32: FindNextChangeNotification (%08xh), Not implemented\n",
738 hChange));
739
740 return(0);
741}
742//******************************************************************************
743//******************************************************************************
744ODINPROCEDURE0(SetFileApisToANSI)
745{
746 dprintf(("SetFileApisToANSI() stub\n"));
747}
748
749/*****************************************************************************
750 * Name : DWORD GetCompressedFileSizeA
751 * Purpose : The GetCompressedFileSizeA function obtains the compressed
752 * size, in bytes, of a specified file.
753 * Parameters: LPCTSTR lpFileName, // pointer to name of file
754 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
755 * high-order doubleword of file size
756 * Variables :
757 * Result : size of compressed file
758 * Remark :
759 * Status : UNTESTED
760 *
761 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
762 *****************************************************************************/
763
764ODINFUNCTION2(DWORD, GetCompressedFileSizeA,
765 LPCTSTR, lpFileName,
766 LPDWORD, lpFileSizeHigh)
767{
768 dprintf(("KERNEL32: GetCompressedFileSizeA (%s, %08xh) not implemented.\n",
769 lpFileName,
770 lpFileSizeHigh));
771
772 /* PH: simply return the standard filesize */
773 return 0;
774}
775
776
777/*****************************************************************************
778 * Name : DWORD GetCompressedFileSizeW
779 * Purpose : The GetCompressedFileSizeE function obtains the compressed
780 * size, in bytes, of a specified file.
781 * Parameters: LPCWSTR lpFileName, // pointer to name of file
782 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
783 * high-order doubleword of file size
784 * Variables :
785 * Result : size of compressed file
786 * Remark :
787 * Status : UNTESTED
788 *
789 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
790 *****************************************************************************/
791
792ODINFUNCTION2(DWORD, GetCompressedFileSizeW,
793 LPCWSTR, lpFileName,
794 LPDWORD, lpFileSizeHigh)
795{
796 LPCTSTR lpAsciiFileName; /* converted filename */
797 DWORD rc; /* function result */
798
799 dprintf(("KERNEL32: GetCompressedFileSizeW (%s, %08xh)\n",
800 lpFileName,
801 lpFileSizeHigh));
802
803 lpAsciiFileName = UnicodeToAsciiString( (LPWSTR) lpFileName);
804
805 rc = GetCompressedFileSizeA(lpAsciiFileName,
806 lpFileSizeHigh);
807
808 FreeAsciiString( (char *) lpAsciiFileName);
809
810 return (rc); /* return result */
811}
812
813
814/*****************************************************************************
815 * Name : BOOL GetFileAttributesExA
816 * Purpose :
817 * Parameters:
818 * Variables :
819 * Result :
820 * Remark : KERNEL32.874
821 * Status : UNTESTED
822 *
823 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
824 *****************************************************************************/
825
826ODINFUNCTION3(BOOL, GetFileAttributesExA,
827 LPCSTR, lpFileName,
828 GET_FILEEX_INFO_LEVELS, fInfoLevelId,
829 LPVOID, lpFileInformation)
830{
831 BOOL rc;
832
833 dprintf(("KERNEL32: GetFileAttributesExA(%s,%08xh,%08xh) mostly implemented.\n",
834 lpFileName,
835 fInfoLevelId,
836 lpFileInformation));
837
838 if (lpFileName == NULL) return FALSE;
839 if (lpFileInformation == NULL) return FALSE;
840
841 if (fInfoLevelId == GetFileExInfoStandard)
842 {
843 LPWIN32_FILE_ATTRIBUTE_DATA lpFad = (LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation;
844
845 rc = OSLibDosGetFileAttributesEx((LPSTR)lpFileName,
846 fInfoLevelId,
847 lpFileInformation);
848 return (rc);
849 }
850 else
851 {
852 dprintf(("KERNEL32: GetFileAttributesExA - invalid info level %d!\n",
853 fInfoLevelId));
854 return FALSE;
855 }
856}
857
858
859/*****************************************************************************
860 * Name : BOOL GetFileAttributesExW
861 * Purpose :
862 * Parameters:
863 * Variables :
864 * Result :
865 * Remark : KERNEL32.875
866 * Status : UNTESTED
867 *
868 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
869 *****************************************************************************/
870
871ODINFUNCTION3(BOOL, GetFileAttributesExW,
872 LPCWSTR, lpFileName,
873 GET_FILEEX_INFO_LEVELS, fInfoLevelId,
874 LPVOID, lpFileInformation)
875{
876 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpFileName );
877 BOOL res = GetFileAttributesExA( nameA, fInfoLevelId, lpFileInformation);
878 HeapFree( GetProcessHeap(), 0, nameA );
879 return res;
880}
881
882
Note: See TracBrowser for help on using the repository browser.