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

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

added GetProcessTimes + several fixes

File size: 28.7 KB
Line 
1/* $Id: Fileio.cpp,v 1.18 1999-12-01 18:40:47 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 dprintf(("KERNEL32: GetFullPathName %s\n", arg1));
437 return O32_GetFullPathName(arg1, arg2, arg3, arg4);
438}
439//******************************************************************************
440//******************************************************************************
441ODINFUNCTION4(DWORD, GetFullPathNameW,
442 LPCWSTR, lpFileName,
443 DWORD, nBufferLength,
444 LPWSTR, lpBuffer,
445 LPWSTR *, lpFilePart)
446{
447 char *astring, *asciibuffer, *asciipart;
448 DWORD rc;
449
450 dprintf(("KERNEL32: GetFullPathNameW\n"));
451 asciibuffer = (char *)malloc(nBufferLength+1);
452 astring = UnicodeToAsciiString((LPWSTR)lpFileName);
453
454 rc = O32_GetFullPathName(astring,
455 nBufferLength,
456 asciibuffer,
457 &asciipart);
458
459 dprintf(("KERNEL32: GetFullPathNameW %s returns %s\n",
460 astring,
461 asciibuffer));
462
463 if(rc)
464 AsciiToUnicode(asciibuffer,
465 lpBuffer);
466
467 if(lpFilePart)
468 *lpFilePart = lpBuffer + ((int)asciipart - (int)asciibuffer);
469
470 FreeAsciiString(astring);
471 free(asciibuffer);
472 return(rc);
473}
474//******************************************************************************
475//******************************************************************************
476ODINFUNCTION5(BOOL, LockFile,
477 HANDLE, arg1,
478 DWORD, arg2,
479 DWORD, arg3,
480 DWORD, arg4,
481 DWORD, arg5)
482{
483 dprintf(("KERNEL32: LockFile (%08xh,%08xh,%08xh,%08xh,%08xh)\n",
484 arg1,
485 arg2,
486 arg3,
487 arg4,
488 arg5));
489
490 return HMLockFile(arg1,
491 arg2,
492 arg3,
493 arg4,
494 arg5);
495}
496
497
498/*****************************************************************************
499 * Name : BOOL LockFileEx
500 * Purpose : The LockFileEx function locks a byte range within an open file for shared or exclusive access.
501 * Parameters: HANDLE hFile handle of file to lock
502 * DWORD dwFlags functional behavior modification flags
503 * DWORD dwReserved reserved, must be set to zero
504 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
505 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
506 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
507 * Variables :
508 * Result : TRUE / FALSE
509 * Remark :
510 * Status : UNTESTED STUB
511 *
512 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
513 *****************************************************************************/
514
515ODINFUNCTION6(BOOL, LockFileEx,
516 HANDLE, hFile,
517 DWORD, dwFlags,
518 DWORD, dwReserved,
519 DWORD, nNumberOfBytesToLockLow,
520 DWORD, nNumberOfBytesToLockHigh,
521 LPOVERLAPPED, lpOverlapped)
522{
523 dprintf(("Kernel32: LockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
524 hFile,
525 dwFlags,
526 dwReserved,
527 nNumberOfBytesToLockLow,
528 nNumberOfBytesToLockHigh,
529 lpOverlapped));
530
531 return(HMLockFile(hFile,
532 lpOverlapped->Offset,
533 lpOverlapped->OffsetHigh,
534 nNumberOfBytesToLockLow,
535 nNumberOfBytesToLockHigh));
536}
537
538
539
540
541//******************************************************************************
542//******************************************************************************
543ODINFUNCTION2(BOOL, MoveFileA,
544 LPCSTR, arg1,
545 LPCSTR, arg2)
546{
547 dprintf(("KERNEL32: MoveFileA\n"));
548 return O32_MoveFile(arg1, arg2);
549}
550//******************************************************************************
551//******************************************************************************
552ODINFUNCTION3(BOOL, MoveFileExA,
553 LPCSTR, arg1,
554 LPCSTR, arg2,
555 DWORD, fdwFlags)
556{
557 dprintf(("KERNEL32: MoveFileExA %s to %s, not complete!\n", arg1, arg2));
558 return O32_MoveFile(arg1, arg2);
559}
560//******************************************************************************
561//******************************************************************************
562ODINFUNCTION2(BOOL, MoveFileW,
563 LPCWSTR, lpSrc,
564 LPCWSTR, lpDest)
565{
566 char *asciisrc, *asciidest;
567 BOOL rc;
568
569 dprintf(("KERNEL32: MoveFileW\n"));
570 asciisrc = UnicodeToAsciiString((LPWSTR)lpSrc);
571 asciidest = UnicodeToAsciiString((LPWSTR)lpDest);
572 rc = O32_MoveFile(asciisrc, asciidest);
573 FreeAsciiString(asciisrc);
574 FreeAsciiString(asciidest);
575 return(rc);
576}
577//******************************************************************************
578//******************************************************************************
579ODINFUNCTION3(BOOL, MoveFileExW,
580 LPCWSTR, arg1,
581 LPCWSTR, arg2,
582 DWORD, fdwFlags)
583{
584 dprintf(("KERNEL32: MoveFileExW %s to %s, not complete!\n", arg1, arg2));
585 return MoveFileW(arg1, arg2);
586}
587//******************************************************************************
588/*****************************************************************************
589ODINFUNCTION3(*, :,
590 HFILE, WIN32API,
591 OpenFile *, Purpose,
592 :, forwardOpenFile to Open32
593 * Parameters:
594 * Variables :
595 * Result : API returncode
596 * Remark : modified for handle translation support
597 * Status : @@@PH verify if 0 is a valid "invalid handle" :)
598 *
599 * Author : Patrick Haller [Fri, 1998/06/12 02:53]
600 *****************************************************************************/
601
602ODINFUNCTION3(HFILE, OpenFile,
603 LPCSTR, arg1,
604 OFSTRUCT *, arg2,
605 UINT, arg3)
606{
607 HFILE hFile;
608
609 dprintf(("KERNEL32: OpenFile(%s, %08xh, %08xh)\n",
610 arg1,
611 arg2,
612 arg3));
613
614 hFile = HMOpenFile(arg1, /* call open32 */
615 arg2,
616 arg3);
617
618 return (hFile);
619}
620//******************************************************************************
621//******************************************************************************
622ODINFUNCTION5(BOOL, UnlockFile,
623 HANDLE, arg1,
624 DWORD, arg2,
625 DWORD, arg3,
626 DWORD, arg4,
627 DWORD, arg5)
628{
629 dprintf(("KERNEL32: UnlockFile(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
630 arg1,
631 arg2,
632 arg3,
633 arg4,
634 arg5));
635
636 return HMUnlockFile(arg1,
637 arg2,
638 arg3,
639 arg4,
640 arg5);
641}
642
643
644/*****************************************************************************
645 * Name : BOOL UnlockFileEx
646 * Purpose : The UnlockFileEx function unlocks a previously locked byte range in an open file.
647 * Parameters: HANDLE hFile handle of file to lock
648 * DWORD dwReserved reserved, must be set to zero
649 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
650 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
651 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
652 * Variables :
653 * Result : TRUE / FALSE
654 * Remark :
655 * Status : UNTESTED STUB
656 *
657 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
658 *****************************************************************************/
659
660ODINFUNCTION5(BOOL, UnlockFileEx,
661 HANDLE, hFile,
662 DWORD, dwReserved,
663 DWORD, nNumberOfBytesToLockLow,
664 DWORD, nNumberOfBytesToLockHigh,
665 LPOVERLAPPED, lpOverlapped)
666{
667 dprintf(("Kernel32: UnlockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
668 hFile,
669 dwReserved,
670 nNumberOfBytesToLockLow,
671 nNumberOfBytesToLockHigh,
672 lpOverlapped));
673
674 return(HMUnlockFile(hFile,
675 lpOverlapped->Offset,
676 lpOverlapped->OffsetHigh,
677 nNumberOfBytesToLockLow,
678 nNumberOfBytesToLockHigh));
679}
680//******************************************************************************
681//******************************************************************************
682ODINFUNCTION3(DWORD, GetShortPathNameA,
683 LPCTSTR, lpszLongPath,
684 LPTSTR, lpszShortPath,
685 DWORD, cchBuffer)
686{
687 int length;
688
689 dprintf(("KERNEL32: GetShortPathNameA of %s, just copying it\n", lpszLongPath));
690 length = strlen(lpszLongPath) + 1;
691 if(length > cchBuffer) {
692 *lpszShortPath = 0;
693 return(length);
694 }
695 memcpy(lpszShortPath, lpszLongPath, length);
696 return(length-1);
697}
698//******************************************************************************
699//******************************************************************************
700ODINFUNCTION3(DWORD, GetShortPathNameW,
701 LPCWSTR, lpszLongPath,
702 LPWSTR, lpszShortPath,
703 DWORD, cchBuffer)
704{
705 int length;
706
707 dprintf(("KERNEL32: GetShortPathNameW; just copying it\n"));
708 length = UniStrlen((UniChar*)lpszLongPath) + 1;
709 if(length > cchBuffer) {
710 *lpszShortPath = 0;
711 return(length);
712 }
713 memcpy(lpszShortPath, lpszLongPath, length*sizeof(USHORT));
714 return(length-1);
715}
716//******************************************************************************
717//******************************************************************************
718ODINFUNCTION3(HANDLE, FindFirstChangeNotificationA,
719 LPCSTR, lpPathName,
720 BOOL, bWatchSubtree,
721 DWORD, dwNotifyFilter)
722{
723 dprintf(("KERNEL32: FindFirstChangeNotificationA, Not implemented\n"));
724 return(0);
725}
726//******************************************************************************
727//******************************************************************************
728ODINFUNCTION1(BOOL, FindNextChangeNotification,
729 HANDLE, hChange)
730{
731 dprintf(("KERNEL32: FindNextChangeNotification (%08xh), Not implemented\n",
732 hChange));
733
734 return(0);
735}
736//******************************************************************************
737//******************************************************************************
738ODINPROCEDURE0(SetFileApisToANSI)
739{
740 dprintf(("SetFileApisToANSI() stub\n"));
741}
742
743/*****************************************************************************
744 * Name : DWORD GetCompressedFileSizeA
745 * Purpose : The GetCompressedFileSizeA function obtains the compressed
746 * size, in bytes, of a specified file.
747 * Parameters: LPCTSTR lpFileName, // pointer to name of file
748 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
749 * high-order doubleword of file size
750 * Variables :
751 * Result : size of compressed file
752 * Remark :
753 * Status : UNTESTED
754 *
755 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
756 *****************************************************************************/
757
758ODINFUNCTION2(DWORD, GetCompressedFileSizeA,
759 LPCTSTR, lpFileName,
760 LPDWORD, lpFileSizeHigh)
761{
762 dprintf(("KERNEL32: GetCompressedFileSizeA (%s, %08xh) not implemented.\n",
763 lpFileName,
764 lpFileSizeHigh));
765
766 /* PH: simply return the standard filesize */
767 return 0;
768}
769
770
771/*****************************************************************************
772 * Name : DWORD GetCompressedFileSizeW
773 * Purpose : The GetCompressedFileSizeE function obtains the compressed
774 * size, in bytes, of a specified file.
775 * Parameters: LPCWSTR lpFileName, // pointer to name of file
776 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
777 * high-order doubleword of file size
778 * Variables :
779 * Result : size of compressed file
780 * Remark :
781 * Status : UNTESTED
782 *
783 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
784 *****************************************************************************/
785
786ODINFUNCTION2(DWORD, GetCompressedFileSizeW,
787 LPCWSTR, lpFileName,
788 LPDWORD, lpFileSizeHigh)
789{
790 LPCTSTR lpAsciiFileName; /* converted filename */
791 DWORD rc; /* function result */
792
793 dprintf(("KERNEL32: GetCompressedFileSizeW (%s, %08xh)\n",
794 lpFileName,
795 lpFileSizeHigh));
796
797 lpAsciiFileName = UnicodeToAsciiString( (LPWSTR) lpFileName);
798
799 rc = GetCompressedFileSizeA(lpAsciiFileName,
800 lpFileSizeHigh);
801
802 FreeAsciiString( (char *) lpAsciiFileName);
803
804 return (rc); /* return result */
805}
806
807
808/*****************************************************************************
809 * Name : BOOL GetFileAttributesExA
810 * Purpose :
811 * Parameters:
812 * Variables :
813 * Result :
814 * Remark : KERNEL32.874
815 * Status : UNTESTED
816 *
817 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
818 *****************************************************************************/
819
820ODINFUNCTION3(BOOL, GetFileAttributesExA,
821 LPCSTR, lpFileName,
822 GET_FILEEX_INFO_LEVELS, fInfoLevelId,
823 LPVOID, lpFileInformation)
824{
825 BOOL rc;
826
827 dprintf(("KERNEL32: GetFileAttributesExA(%s,%08xh,%08xh) mostly implemented.\n",
828 lpFileName,
829 fInfoLevelId,
830 lpFileInformation));
831
832 if (lpFileName == NULL) return FALSE;
833 if (lpFileInformation == NULL) return FALSE;
834
835 if (fInfoLevelId == GetFileExInfoStandard)
836 {
837 LPWIN32_FILE_ATTRIBUTE_DATA lpFad = (LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation;
838
839 rc = OSLibDosGetFileAttributesEx((LPSTR)lpFileName,
840 fInfoLevelId,
841 lpFileInformation);
842 return (rc);
843 }
844 else
845 {
846 dprintf(("KERNEL32: GetFileAttributesExA - invalid info level %d!\n",
847 fInfoLevelId));
848 return FALSE;
849 }
850}
851
852
853/*****************************************************************************
854 * Name : BOOL GetFileAttributesExW
855 * Purpose :
856 * Parameters:
857 * Variables :
858 * Result :
859 * Remark : KERNEL32.875
860 * Status : UNTESTED
861 *
862 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
863 *****************************************************************************/
864
865ODINFUNCTION3(BOOL, GetFileAttributesExW,
866 LPCWSTR, lpFileName,
867 GET_FILEEX_INFO_LEVELS, fInfoLevelId,
868 LPVOID, lpFileInformation)
869{
870 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpFileName );
871 BOOL res = GetFileAttributesExA( nameA, fInfoLevelId, lpFileInformation);
872 HeapFree( GetProcessHeap(), 0, nameA );
873 return res;
874}
875
876
Note: See TracBrowser for help on using the repository browser.