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

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

handlemanager bugfix ((Msg)WaitForMultipleObjects)

File size: 28.8 KB
Line 
1/* $Id: Fileio.cpp,v 1.21 1999-12-30 18:49:32 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, lpszFile)
244{
245 dprintf(("DeleteFileA %s", lpszFile));
246 return O32_DeleteFile(lpszFile);
247}
248//******************************************************************************
249//******************************************************************************
250ODINFUNCTION1(BOOL, DeleteFileW,
251 LPCWSTR, arg1)
252{
253 BOOL rc;
254 char *astring;
255
256 astring = UnicodeToAsciiString((LPWSTR)arg1);
257 rc = O32_DeleteFile(astring);
258 FreeAsciiString(astring);
259 return(rc);
260}
261//******************************************************************************
262//******************************************************************************
263ODINFUNCTION4(UINT, GetTempFileNameA,
264 LPCSTR, arg1,
265 LPCSTR, arg2,
266 UINT, arg3,
267 LPSTR, arg4)
268{
269 return O32_GetTempFileName(arg1, arg2, arg3, arg4);
270}
271//******************************************************************************
272//******************************************************************************
273ODINFUNCTION4(UINT, GetTempFileNameW,
274 LPCWSTR, lpPathName,
275 LPCWSTR, lpPrefixString,
276 UINT, uUnique,
277 LPWSTR, lpTempFileName)
278{
279 char *asciipath, *asciiprefix;
280 char *asciitemp = (char *)malloc(MAX_PATH+1);
281 UINT rc;
282
283 asciipath = UnicodeToAsciiString((LPWSTR)lpPathName);
284 asciiprefix = UnicodeToAsciiString((LPWSTR)lpPrefixString);
285 rc = O32_GetTempFileName(asciipath, asciiprefix, uUnique, asciitemp);
286 if(rc) AsciiToUnicode(asciitemp, lpTempFileName);
287 FreeAsciiString(asciiprefix);
288 FreeAsciiString(asciipath);
289 free(asciitemp);
290 return(rc);
291}
292//******************************************************************************
293//******************************************************************************
294ODINFUNCTION2(UINT, GetTempPathA,
295 UINT, arg1,
296 LPSTR, arg2)
297{
298 return O32_GetTempPath(arg1, arg2);
299}
300//******************************************************************************
301//******************************************************************************
302ODINFUNCTION2(UINT, GetTempPathW,
303 UINT, nBufferLength,
304 LPWSTR, lpBuffer)
305{
306 char *asciibuffer = (char *)malloc(nBufferLength+1);
307 DWORD rc;
308
309 rc = O32_GetTempPath(nBufferLength, asciibuffer);
310 if(rc) AsciiToUnicode(asciibuffer, lpBuffer);
311 free(asciibuffer);
312 return(rc);
313}
314//******************************************************************************
315//******************************************************************************
316ODINFUNCTION5(BOOL, ReadFile,
317 HANDLE, hFile,
318 PVOID, pBuffer,
319 DWORD, dwLength,
320 PDWORD, lpNumberOfBytesRead,
321 LPOVERLAPPED, lpOverlapped)
322{
323 return (HMReadFile(hFile,
324 pBuffer,
325 dwLength,
326 lpNumberOfBytesRead,
327 lpOverlapped));
328}
329//******************************************************************************
330//******************************************************************************
331ODINFUNCTION4(DWORD, SetFilePointer,
332 HANDLE, hFile,
333 LONG, lDistanceToMove,
334 PLONG, lpDistanceToMoveHigh,
335 DWORD, dwMoveMethod)
336{
337 dprintf(("KERNEL32: SetFilePointer(%08xh,%08xh,%08xh,%08xh)\n",
338 hFile,
339 lDistanceToMove,
340 lpDistanceToMoveHigh,
341 dwMoveMethod));
342
343 return(HMSetFilePointer(hFile,
344 lDistanceToMove,
345 lpDistanceToMoveHigh,
346 dwMoveMethod));
347}
348//******************************************************************************
349//******************************************************************************
350ODINFUNCTION5(BOOL, WriteFile,
351 HANDLE, hFile,
352 LPCVOID, buffer,
353 DWORD, nrbytes,
354 LPDWORD, nrbyteswritten,
355 LPOVERLAPPED, lpOverlapped)
356{
357 dprintf(("KERNEL32: WriteFile(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
358 hFile,
359 buffer,
360 nrbytes,
361 nrbyteswritten,
362 lpOverlapped));
363
364 return (HMWriteFile(hFile,
365 buffer,
366 nrbytes,
367 nrbyteswritten,
368 lpOverlapped));
369}
370//******************************************************************************
371//******************************************************************************
372ODINFUNCTION1(DWORD, GetFileAttributesA,
373 LPCSTR, lpszFileName)
374{
375 DWORD rc, error;
376
377 rc = O32_GetFileAttributes((LPSTR)lpszFileName);
378#if 0 // need more tests, maybe there is also a better way to hide simulated b:
379 if(rc == -1 && lpszFileName != NULL && !strnicmp(lpszFileName, "B:", 2))
380 {
381 error = GetLastError();
382 if(error = ERROR_DISK_CHANGE)
383 SetLastError(ERROR_NOT_READY);
384 else
385 SetLastError(error);
386 }
387#endif
388 dprintf(("KERNEL32: GetFileAttributes of %s returned %d\n", lpszFileName, rc));
389 return(rc);
390}
391//******************************************************************************
392//******************************************************************************
393ODINFUNCTION1(DWORD, GetFileAttributesW,
394 LPCWSTR, arg1)
395{
396 DWORD rc;
397 char *astring;
398
399 dprintf(("KERNEL32: GetFileAttributesW\n"));
400 astring = UnicodeToAsciiString((LPWSTR)arg1);
401 rc = ODIN_GetFileAttributesA(astring);
402 FreeAsciiString(astring);
403 return(rc);
404}
405//******************************************************************************
406//******************************************************************************
407ODINFUNCTION2(BOOL, SetFileAttributesA,
408 LPCSTR, arg1,
409 DWORD, arg2)
410{
411 dprintf(("KERNEL32: SetFileAttributes of %s\n", arg1));
412 return O32_SetFileAttributes(arg1, arg2);
413}
414//******************************************************************************
415//******************************************************************************
416ODINFUNCTION2(BOOL, SetFileAttributesW,
417 LPCWSTR, lpFileName,
418 DWORD, dwFileAttributes)
419{
420 char *asciifile;
421 BOOL rc;
422
423 dprintf(("KERNEL32: SetFileAttributesW\n"));
424 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
425 rc = O32_SetFileAttributes(asciifile, dwFileAttributes);
426 FreeAsciiString(asciifile);
427 return(rc);
428}
429//******************************************************************************
430//******************************************************************************
431ODINFUNCTION4(DWORD, GetFullPathNameA,
432 LPCSTR, arg1,
433 DWORD, arg2,
434 LPSTR, arg3,
435 LPSTR *, arg4)
436{
437 char *ptr;
438 dprintf(("KERNEL32: GetFullPathName %s\n", arg1));
439 while((ptr = strchr(arg1, '/')) != NULL)
440 *ptr = '\\';
441 return O32_GetFullPathName(arg1, arg2, arg3, arg4);
442}
443//******************************************************************************
444//******************************************************************************
445ODINFUNCTION4(DWORD, GetFullPathNameW,
446 LPCWSTR, lpFileName,
447 DWORD, nBufferLength,
448 LPWSTR, lpBuffer,
449 LPWSTR *, lpFilePart)
450{
451 char *astring, *asciibuffer, *asciipart;
452 DWORD rc;
453
454 asciibuffer = (char *)malloc(nBufferLength+1);
455 astring = UnicodeToAsciiString((LPWSTR)lpFileName);
456
457 rc = ODIN_GetFullPathNameA(astring,
458 nBufferLength,
459 asciibuffer,
460 &asciipart);
461
462 dprintf(("KERNEL32: GetFullPathNameW %s returns %s\n",
463 astring,
464 asciibuffer));
465
466 if(rc)
467 AsciiToUnicode(asciibuffer,
468 lpBuffer);
469
470 if(lpFilePart)
471 *lpFilePart = lpBuffer + ((int)asciipart - (int)asciibuffer);
472
473 FreeAsciiString(astring);
474 free(asciibuffer);
475 return(rc);
476}
477//******************************************************************************
478//******************************************************************************
479ODINFUNCTION5(BOOL, LockFile,
480 HANDLE, arg1,
481 DWORD, arg2,
482 DWORD, arg3,
483 DWORD, arg4,
484 DWORD, arg5)
485{
486 dprintf(("KERNEL32: LockFile (%08xh,%08xh,%08xh,%08xh,%08xh)\n",
487 arg1,
488 arg2,
489 arg3,
490 arg4,
491 arg5));
492
493 return HMLockFile(arg1,
494 arg2,
495 arg3,
496 arg4,
497 arg5);
498}
499
500
501/*****************************************************************************
502 * Name : BOOL LockFileEx
503 * Purpose : The LockFileEx function locks a byte range within an open file for shared or exclusive access.
504 * Parameters: HANDLE hFile handle of file to lock
505 * DWORD dwFlags functional behavior modification flags
506 * DWORD dwReserved reserved, must be set to zero
507 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
508 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
509 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
510 * Variables :
511 * Result : TRUE / FALSE
512 * Remark :
513 * Status : UNTESTED STUB
514 *
515 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
516 *****************************************************************************/
517
518ODINFUNCTION6(BOOL, LockFileEx,
519 HANDLE, hFile,
520 DWORD, dwFlags,
521 DWORD, dwReserved,
522 DWORD, nNumberOfBytesToLockLow,
523 DWORD, nNumberOfBytesToLockHigh,
524 LPOVERLAPPED, lpOverlapped)
525{
526 dprintf(("Kernel32: LockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
527 hFile,
528 dwFlags,
529 dwReserved,
530 nNumberOfBytesToLockLow,
531 nNumberOfBytesToLockHigh,
532 lpOverlapped));
533
534 return(HMLockFile(hFile,
535 lpOverlapped->Offset,
536 lpOverlapped->OffsetHigh,
537 nNumberOfBytesToLockLow,
538 nNumberOfBytesToLockHigh));
539}
540
541
542
543
544//******************************************************************************
545//******************************************************************************
546ODINFUNCTION2(BOOL, MoveFileA,
547 LPCSTR, arg1,
548 LPCSTR, arg2)
549{
550 dprintf(("KERNEL32: MoveFileA %s %s", arg1, arg2));
551 return O32_MoveFile(arg1, arg2);
552}
553//******************************************************************************
554//******************************************************************************
555ODINFUNCTION3(BOOL, MoveFileExA,
556 LPCSTR, arg1,
557 LPCSTR, arg2,
558 DWORD, fdwFlags)
559{
560 dprintf(("KERNEL32: MoveFileExA %s to %s, not complete!\n", arg1, arg2));
561 return O32_MoveFile(arg1, arg2);
562}
563//******************************************************************************
564//******************************************************************************
565ODINFUNCTION2(BOOL, MoveFileW,
566 LPCWSTR, lpSrc,
567 LPCWSTR, lpDest)
568{
569 char *asciisrc, *asciidest;
570 BOOL rc;
571
572 dprintf(("KERNEL32: MoveFileW\n"));
573 asciisrc = UnicodeToAsciiString((LPWSTR)lpSrc);
574 asciidest = UnicodeToAsciiString((LPWSTR)lpDest);
575 rc = O32_MoveFile(asciisrc, asciidest);
576 FreeAsciiString(asciisrc);
577 FreeAsciiString(asciidest);
578 return(rc);
579}
580//******************************************************************************
581//******************************************************************************
582ODINFUNCTION3(BOOL, MoveFileExW,
583 LPCWSTR, arg1,
584 LPCWSTR, arg2,
585 DWORD, fdwFlags)
586{
587 dprintf(("KERNEL32: MoveFileExW %s to %s, not complete!\n", arg1, arg2));
588 return MoveFileW(arg1, arg2);
589}
590//******************************************************************************
591/*****************************************************************************
592ODINFUNCTION3(*, :,
593 HFILE, WIN32API,
594 OpenFile *, Purpose,
595 :, forwardOpenFile to Open32
596 * Parameters:
597 * Variables :
598 * Result : API returncode
599 * Remark : modified for handle translation support
600 * Status : @@@PH verify if 0 is a valid "invalid handle" :)
601 *
602 * Author : Patrick Haller [Fri, 1998/06/12 02:53]
603 *****************************************************************************/
604
605ODINFUNCTION3(HFILE, OpenFile,
606 LPCSTR, arg1,
607 OFSTRUCT *, arg2,
608 UINT, arg3)
609{
610 HFILE hFile;
611
612 dprintf(("KERNEL32: OpenFile(%s, %08xh, %08xh)\n",
613 arg1,
614 arg2,
615 arg3));
616
617 hFile = HMOpenFile(arg1, /* call open32 */
618 arg2,
619 arg3);
620
621 return (hFile);
622}
623//******************************************************************************
624//******************************************************************************
625ODINFUNCTION5(BOOL, UnlockFile,
626 HANDLE, arg1,
627 DWORD, arg2,
628 DWORD, arg3,
629 DWORD, arg4,
630 DWORD, arg5)
631{
632 dprintf(("KERNEL32: UnlockFile(%08xh,%08xh,%08xh,%08xh,%08xh)\n",
633 arg1,
634 arg2,
635 arg3,
636 arg4,
637 arg5));
638
639 return HMUnlockFile(arg1,
640 arg2,
641 arg3,
642 arg4,
643 arg5);
644}
645
646
647/*****************************************************************************
648 * Name : BOOL UnlockFileEx
649 * Purpose : The UnlockFileEx function unlocks a previously locked byte range in an open file.
650 * Parameters: HANDLE hFile handle of file to lock
651 * DWORD dwReserved reserved, must be set to zero
652 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
653 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
654 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
655 * Variables :
656 * Result : TRUE / FALSE
657 * Remark :
658 * Status : UNTESTED STUB
659 *
660 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
661 *****************************************************************************/
662
663ODINFUNCTION5(BOOL, UnlockFileEx,
664 HANDLE, hFile,
665 DWORD, dwReserved,
666 DWORD, nNumberOfBytesToLockLow,
667 DWORD, nNumberOfBytesToLockHigh,
668 LPOVERLAPPED, lpOverlapped)
669{
670 dprintf(("Kernel32: UnlockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
671 hFile,
672 dwReserved,
673 nNumberOfBytesToLockLow,
674 nNumberOfBytesToLockHigh,
675 lpOverlapped));
676
677 return(HMUnlockFile(hFile,
678 lpOverlapped->Offset,
679 lpOverlapped->OffsetHigh,
680 nNumberOfBytesToLockLow,
681 nNumberOfBytesToLockHigh));
682}
683//******************************************************************************
684//******************************************************************************
685ODINFUNCTION3(DWORD, GetShortPathNameA,
686 LPCTSTR, lpszLongPath,
687 LPTSTR, lpszShortPath,
688 DWORD, cchBuffer)
689{
690 int length;
691
692 dprintf(("KERNEL32: GetShortPathNameA of %s, just copying it\n", lpszLongPath));
693 length = strlen(lpszLongPath) + 1;
694 if(length > cchBuffer) {
695 *lpszShortPath = 0;
696 return(length);
697 }
698 memcpy(lpszShortPath, lpszLongPath, length);
699 return(length-1);
700}
701//******************************************************************************
702//******************************************************************************
703ODINFUNCTION3(DWORD, GetShortPathNameW,
704 LPCWSTR, lpszLongPath,
705 LPWSTR, lpszShortPath,
706 DWORD, cchBuffer)
707{
708 int length;
709
710 dprintf(("KERNEL32: GetShortPathNameW; just copying it\n"));
711 length = UniStrlen((UniChar*)lpszLongPath) + 1;
712 if(length > cchBuffer) {
713 *lpszShortPath = 0;
714 return(length);
715 }
716 memcpy(lpszShortPath, lpszLongPath, length*sizeof(USHORT));
717 return(length-1);
718}
719//******************************************************************************
720//******************************************************************************
721ODINFUNCTION3(HANDLE, FindFirstChangeNotificationA,
722 LPCSTR, lpPathName,
723 BOOL, bWatchSubtree,
724 DWORD, dwNotifyFilter)
725{
726 dprintf(("KERNEL32: FindFirstChangeNotificationA, Not implemented\n"));
727 return(0);
728}
729//******************************************************************************
730//******************************************************************************
731ODINFUNCTION1(BOOL, FindNextChangeNotification,
732 HANDLE, hChange)
733{
734 dprintf(("KERNEL32: FindNextChangeNotification (%08xh), Not implemented\n",
735 hChange));
736
737 return(0);
738}
739//******************************************************************************
740//******************************************************************************
741ODINPROCEDURE0(SetFileApisToANSI)
742{
743 dprintf(("SetFileApisToANSI() stub\n"));
744}
745
746/*****************************************************************************
747 * Name : DWORD GetCompressedFileSizeA
748 * Purpose : The GetCompressedFileSizeA function obtains the compressed
749 * size, in bytes, of a specified file.
750 * Parameters: LPCTSTR lpFileName, // pointer to name of file
751 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
752 * high-order doubleword of file size
753 * Variables :
754 * Result : size of compressed file
755 * Remark :
756 * Status : UNTESTED
757 *
758 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
759 *****************************************************************************/
760
761ODINFUNCTION2(DWORD, GetCompressedFileSizeA,
762 LPCTSTR, lpFileName,
763 LPDWORD, lpFileSizeHigh)
764{
765 dprintf(("KERNEL32: GetCompressedFileSizeA (%s, %08xh) not implemented.\n",
766 lpFileName,
767 lpFileSizeHigh));
768
769 /* PH: simply return the standard filesize */
770 return 0;
771}
772
773
774/*****************************************************************************
775 * Name : DWORD GetCompressedFileSizeW
776 * Purpose : The GetCompressedFileSizeE function obtains the compressed
777 * size, in bytes, of a specified file.
778 * Parameters: LPCWSTR lpFileName, // pointer to name of file
779 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
780 * high-order doubleword of file size
781 * Variables :
782 * Result : size of compressed file
783 * Remark :
784 * Status : UNTESTED
785 *
786 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
787 *****************************************************************************/
788
789ODINFUNCTION2(DWORD, GetCompressedFileSizeW,
790 LPCWSTR, lpFileName,
791 LPDWORD, lpFileSizeHigh)
792{
793 LPCTSTR lpAsciiFileName; /* converted filename */
794 DWORD rc; /* function result */
795
796 dprintf(("KERNEL32: GetCompressedFileSizeW (%s, %08xh)\n",
797 lpFileName,
798 lpFileSizeHigh));
799
800 lpAsciiFileName = UnicodeToAsciiString( (LPWSTR) lpFileName);
801
802 rc = GetCompressedFileSizeA(lpAsciiFileName,
803 lpFileSizeHigh);
804
805 FreeAsciiString( (char *) lpAsciiFileName);
806
807 return (rc); /* return result */
808}
809
810
811/*****************************************************************************
812 * Name : BOOL GetFileAttributesExA
813 * Purpose :
814 * Parameters:
815 * Variables :
816 * Result :
817 * Remark : KERNEL32.874
818 * Status : UNTESTED
819 *
820 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
821 *****************************************************************************/
822
823ODINFUNCTION3(BOOL, GetFileAttributesExA,
824 LPCSTR, lpFileName,
825 GET_FILEEX_INFO_LEVELS, fInfoLevelId,
826 LPVOID, lpFileInformation)
827{
828 BOOL rc;
829
830 dprintf(("KERNEL32: GetFileAttributesExA(%s,%08xh,%08xh) mostly implemented.\n",
831 lpFileName,
832 fInfoLevelId,
833 lpFileInformation));
834
835 if (lpFileName == NULL) return FALSE;
836 if (lpFileInformation == NULL) return FALSE;
837
838 if (fInfoLevelId == GetFileExInfoStandard)
839 {
840 LPWIN32_FILE_ATTRIBUTE_DATA lpFad = (LPWIN32_FILE_ATTRIBUTE_DATA) lpFileInformation;
841
842 rc = OSLibDosGetFileAttributesEx((LPSTR)lpFileName,
843 fInfoLevelId,
844 lpFileInformation);
845 return (rc);
846 }
847 else
848 {
849 dprintf(("KERNEL32: GetFileAttributesExA - invalid info level %d!\n",
850 fInfoLevelId));
851 return FALSE;
852 }
853}
854
855
856/*****************************************************************************
857 * Name : BOOL GetFileAttributesExW
858 * Purpose :
859 * Parameters:
860 * Variables :
861 * Result :
862 * Remark : KERNEL32.875
863 * Status : UNTESTED
864 *
865 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
866 *****************************************************************************/
867
868ODINFUNCTION3(BOOL, GetFileAttributesExW,
869 LPCWSTR, lpFileName,
870 GET_FILEEX_INFO_LEVELS, fInfoLevelId,
871 LPVOID, lpFileInformation)
872{
873 LPSTR nameA = HEAP_strdupWtoA( GetProcessHeap(), 0, lpFileName );
874 BOOL res = GetFileAttributesExA( nameA, fInfoLevelId, lpFileInformation);
875 HeapFree( GetProcessHeap(), 0, nameA );
876 return res;
877}
878
879
Note: See TracBrowser for help on using the repository browser.