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

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

EB: Hack for GetFullPathNameA + Fixed dprintf in lstrcmpW

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