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

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

changes for OpenThreadToken

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