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

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

* empty log message *

File size: 28.3 KB
Line 
1/*
2 *
3 * Project Odin Software License can be found in LICENSE.TXT
4 *
5 */
6/*
7 * Win32 File IO API functions for OS/2
8 *
9 * Copyright 1998 Sander van Leeuwen
10 * Copyright 1998 Patrick Haller
11 *
12 */
13#include <os2win.h>
14#include <stdlib.h>
15#include <string.h>
16#include "unicode.h"
17#include "handlemanager.h"
18#include "devio.h"
19
20//******************************************************************************
21//******************************************************************************
22HFILE WIN32API CreateFileA(LPCSTR lpszName,
23 DWORD fdwAccess,
24 DWORD fdwShareMode,
25 LPSECURITY_ATTRIBUTES lpsa,
26 DWORD fdwCreate,
27 DWORD fdwAttrsAndFlags,
28 HANDLE hTemplateFile)
29{
30 HANDLE rc;
31 int slen = 0;
32
33 if(lpszName == NULL)
34 return(NULL);
35
36 dprintf(("KERNEL32: CreateFile %s\n", lpszName));
37
38 if(strncmp(lpszName,
39 "\\\\.\\",
40 4) == 0)
41 {
42 return(OS2CreateFile((char *)&lpszName[4],
43 fdwAccess,
44 fdwShareMode));
45 }
46
47 dprintf(("KERNEL32: CreateFile %s %X %X %X %X \n",
48 lpszName,
49 fdwAccess,
50 fdwShareMode,
51 fdwCreate,
52 fdwAttrsAndFlags));
53
54 rc = O32_CreateFile(lpszName,
55 fdwAccess,
56 fdwShareMode,
57 lpsa,
58 fdwCreate,
59 fdwAttrsAndFlags,
60 hTemplateFile);
61
62 /* @@@PH 1998/02/12 Handle Manager support */
63 if (rc == -1)
64 rc = HMCreateFile(lpszName,
65 fdwAccess,
66 fdwShareMode,
67 lpsa,
68 fdwCreate,
69 fdwAttrsAndFlags,
70 hTemplateFile);
71
72 //@@@PH translate handle
73
74 dprintf(("KERNEL32: CreateFile returned %d\n",
75 rc));
76
77 return(rc);
78}
79//******************************************************************************
80//******************************************************************************
81HFILE WIN32API CreateFileW(LPCWSTR arg1,
82 DWORD arg2,
83 DWORD arg3,
84 PSECURITY_ATTRIBUTES arg4,
85 DWORD arg5,
86 DWORD arg6,
87 HANDLE arg7)
88{
89 HANDLE rc;
90 char *astring;
91
92 dprintf(("KERNEL32: CreateFileW"));
93 astring = UnicodeToAsciiString((LPWSTR)arg1);
94 rc = CreateFileA(astring, arg2, arg3, arg4, arg5, arg6, arg7);
95 FreeAsciiString(astring);
96 return(rc);
97}
98//******************************************************************************
99//******************************************************************************
100HANDLE WIN32API FindFirstFileA(LPCSTR arg1, WIN32_FIND_DATAA * arg2)
101{
102 dprintf(("KERNEL32: FindFirstFile %s\n", arg1));
103
104 return O32_FindFirstFile(arg1, arg2);
105}
106//******************************************************************************
107//******************************************************************************
108HANDLE WIN32API FindFirstFileW(LPCWSTR arg1, WIN32_FIND_DATAW * arg2)
109{
110 HANDLE rc;
111 char *astring;
112
113 dprintf(("KERNEL32: FindFirstFileW: not implemented!!"));
114 dprintf(("KERNEL32: FindFirstFileW\n"));
115 astring = UnicodeToAsciiString((LPWSTR)arg1);
116// rc = O32_FindFirstFile(astring, arg2);
117 rc = 0;
118 FreeAsciiString(astring);
119 return(rc);
120}
121//******************************************************************************
122//******************************************************************************
123BOOL WIN32API FindNextFileA(HANDLE arg1, WIN32_FIND_DATAA * arg2)
124{
125 dprintf(("KERNEL32: FindNextFile"));
126 return O32_FindNextFile(arg1, arg2);
127}
128//******************************************************************************
129//TODO: convert string in WIN32_FIND_DATAW * structure
130//******************************************************************************
131BOOL WIN32API FindNextFileW(HANDLE arg1, WIN32_FIND_DATAW * arg2)
132{
133 dprintf(("KERNEL32: FindNextFileW Not properly implemented!\n"));
134// return O32_FindNextFile(arg1, arg2);
135 return 0;
136}
137//******************************************************************************
138//******************************************************************************
139BOOL WIN32API FindClose(HANDLE arg1)
140{
141 dprintf(("KERNEL32: FindClose\n"));
142 return O32_FindClose(arg1);
143}
144//******************************************************************************
145//******************************************************************************
146DWORD WIN32API GetFileType(HANDLE file)
147{
148 DWORD rc;
149
150 /* @@@PH 1998/02/12 Handle Manager support */
151 if (IS_HM_HANDLE(file))
152 return (HMGetFileType(file));
153
154 dprintf(("KERNEL32: GetFileType %d\n", file));
155 rc = O32_GetFileType(file);
156 if(rc == 0) {//bugfix
157 rc = 1;
158 }
159 dprintf(("KERNEL32: GetFileType returned %d\n", rc));
160 return(rc);
161}
162//******************************************************************************
163//******************************************************************************
164DWORD WIN32API GetFileInformationByHandle(HANDLE arg1,
165 BY_HANDLE_FILE_INFORMATION *arg2)
166{
167 DWORD rc;
168
169 rc = O32_GetFileInformationByHandle(arg1, arg2);
170 dprintf(("KERNEL32: GetFileInformationByHandle (%X) returned %d\n", arg1, rc));
171
172 if(rc == 0) {//might be converted _lopen handle, so go get it
173 // arg1 = ConvertHandle(arg1);
174 //@@@PH translate handle
175 rc = O32_GetFileInformationByHandle(arg1, arg2);
176 dprintf(("KERNEL32: GetFileInformationByHandle (%X) returned %d\n", arg1, rc));
177 }
178
179 return(rc);
180}
181//******************************************************************************
182//******************************************************************************
183BOOL WIN32API SetEndOfFile( HANDLE arg1)
184{
185 dprintf(("KERNEL32: SetEndOfFile\n"));
186 return O32_SetEndOfFile(arg1);
187}
188//******************************************************************************
189//******************************************************************************
190BOOL WIN32API SetFileTime( HANDLE arg1, const FILETIME * arg2, const FILETIME * arg3, const FILETIME * arg4)
191{
192 dprintf(("KERNEL32: SetFileTime\n"));
193 return O32_SetFileTime(arg1, arg2, arg3, arg4);
194}
195//******************************************************************************
196//******************************************************************************
197INT WIN32API CompareFileTime( FILETIME * arg1, FILETIME * arg2)
198{
199 dprintf(("KERNEL32: CompareFileTime\n"));
200 return O32_CompareFileTime(arg1, arg2);
201}
202//******************************************************************************
203//******************************************************************************
204BOOL WIN32API CopyFileA(LPCSTR arg1, LPCSTR arg2, BOOL arg3)
205{
206 dprintf(("KERNEL32: CopyFile %s %s\n", arg1, arg2));
207 return O32_CopyFile(arg1, arg2, arg3);
208}
209//******************************************************************************
210//SvL: 24-6-'97 - Added
211//******************************************************************************
212BOOL WIN32API CopyFileW(LPCWSTR arg1, LPCWSTR arg2, BOOL arg3)
213{
214 BOOL rc;
215 char *astring1, *astring2;
216
217 astring1 = UnicodeToAsciiString((LPWSTR)arg1);
218 astring2 = UnicodeToAsciiString((LPWSTR)arg2);
219 dprintf(("KERNEL32: CopyFileW\n"));
220 rc = O32_CopyFile(astring1, astring2, arg3);
221 FreeAsciiString(astring2);
222 FreeAsciiString(astring1);
223 return(rc);
224}
225//******************************************************************************
226//******************************************************************************
227DWORD WIN32API GetFileSize( HANDLE arg1, PDWORD arg2)
228{
229 dprintf(("KERNEL32: GetFileSize\n"));
230 return O32_GetFileSize(arg1, arg2);
231}
232//******************************************************************************
233//******************************************************************************
234BOOL WIN32API DeleteFileA(LPCSTR arg1)
235{
236 dprintf(("KERNEL32: DeleteFile %s\n", arg1));
237 return O32_DeleteFile(arg1);
238}
239//******************************************************************************
240//******************************************************************************
241BOOL WIN32API DeleteFileW(LPCWSTR arg1)
242{
243 BOOL rc;
244 char *astring;
245
246 dprintf(("KERNEL32: DeleteFileW\n"));
247 astring = UnicodeToAsciiString((LPWSTR)arg1);
248 rc = O32_DeleteFile(astring);
249 FreeAsciiString(astring);
250 return(rc);
251}
252//******************************************************************************
253//******************************************************************************
254UINT WIN32API GetTempFileNameA(LPCSTR arg1, LPCSTR arg2, UINT arg3, LPSTR arg4)
255{
256 dprintf(("KERNEL32: GetTempFileName"));
257 return O32_GetTempFileName(arg1, arg2, arg3, arg4);
258}
259//******************************************************************************
260//******************************************************************************
261UINT WIN32API GetTempFileNameW(LPCWSTR lpPathName, LPCWSTR lpPrefixString,
262 UINT uUnique, LPWSTR lpTempFileName)
263{
264 char *asciipath, *asciiprefix;
265 char *asciitemp = (char *)malloc(MAX_PATH+1);
266 UINT rc;
267
268 dprintf(("KERNEL32: GetTempFileNameW"));
269 asciipath = UnicodeToAsciiString((LPWSTR)lpPathName);
270 asciiprefix = UnicodeToAsciiString((LPWSTR)lpPrefixString);
271 rc = O32_GetTempFileName(asciipath, asciiprefix, uUnique, asciitemp);
272 if(rc) AsciiToUnicode(asciitemp, lpTempFileName);
273 FreeAsciiString(asciiprefix);
274 FreeAsciiString(asciipath);
275 free(asciitemp);
276 return(rc);
277}
278//******************************************************************************
279//******************************************************************************
280UINT WIN32API GetTempPathA(UINT arg1, LPSTR arg2)
281{
282 dprintf(("KERNEL32: GetTempPath\n"));
283 return O32_GetTempPath(arg1, arg2);
284}
285//******************************************************************************
286//******************************************************************************
287UINT WIN32API GetTempPathW(UINT nBufferLength, LPWSTR lpBuffer)
288{
289 char *asciibuffer = (char *)malloc(nBufferLength+1);
290 DWORD rc;
291
292 dprintf(("KERNEL32: GetTempPathW\n"));
293 rc = O32_GetTempPath(nBufferLength, asciibuffer);
294 if(rc) AsciiToUnicode(asciibuffer, lpBuffer);
295 free(asciibuffer);
296 return(rc);
297}
298//******************************************************************************
299//******************************************************************************
300BOOL WIN32API ReadFile( HANDLE arg1, PVOID arg2, DWORD arg3, PDWORD arg4, LPOVERLAPPED arg5)
301{
302 BOOL rc;
303
304 /* @@@PH 1998/02/12 Handle Manager support */
305 if (IS_HM_HANDLE(arg1))
306 return (HMReadFile(arg1, arg2, arg3, arg4, arg5));
307
308 rc = O32_ReadFile(arg1, arg2, arg3, arg4, arg5);
309 dprintf(("KERNEL32: ReadFile %X %d bytes returned %d\n", arg1, arg3, rc));
310 return(rc);
311}
312//******************************************************************************
313//******************************************************************************
314DWORD WIN32API SetFilePointer(HANDLE hFile,
315 LONG lDistanceToMove,
316 PLONG lpDistanceToMoveHigh,
317 DWORD dwMoveMethod)
318{
319//// dprintf(("KERNEL32: SetFilePointer\n"));
320
321 //@@@PH translate handle
322
323
324 return(O32_SetFilePointer(hFile,
325 lDistanceToMove,
326 lpDistanceToMoveHigh,
327 dwMoveMethod));
328}
329//******************************************************************************
330//******************************************************************************
331BOOL WIN32API WriteFile(HANDLE hFile,
332 LPCVOID buffer,
333 DWORD nrbytes,
334 LPDWORD nrbyteswritten,
335 LPOVERLAPPED lpOverlapped)
336{
337 BOOL rc;
338
339 //@@@PH translate handle
340 //KSO Aug 31 1998: when writing 0 bytes to a file win32 sets eof here.
341 if (nrbytes == 0 && !IS_HM_HANDLE(hFile))
342 {
343 *nrbyteswritten = 0;
344 return O32_SetEndOfFile(hFile);
345 }
346
347 /* @@@PH 1998/02/12 Handle Manager support */
348 if (IS_HM_HANDLE(hFile))
349 return (HMWriteFile(hFile,
350 buffer,
351 nrbytes,
352 nrbyteswritten,
353 lpOverlapped));
354
355 rc = O32_WriteFile(hFile, buffer, nrbytes, nrbyteswritten, (LPOVERLAPPED)lpOverlapped);
356 if(rc == 0 && GetLastError() == 436) { //ERROR_VIO_INVALID_HANDLE (OS/2)
357//// dprintf(("KERNEL32: WriteFile %s\n", buffer));
358 return(TRUE);
359 }
360 dprintf(("KERNEL32: WriteFile handle = %X, %d bytes, returned %d (%X)\n", hFile, nrbytes, rc, GetLastError()));
361 return(rc);
362}
363//******************************************************************************
364//******************************************************************************
365DWORD WIN32API SearchPathA( LPCSTR arg1, LPCSTR arg2, LPCSTR arg3, DWORD arg4, LPSTR arg5, LPSTR * arg6)
366{
367 dprintf(("KERNEL32: SearchPathA\n"));
368 return O32_SearchPath(arg1, arg2, arg3, arg4, arg5, arg6);
369}
370//******************************************************************************
371//******************************************************************************
372DWORD WIN32API SearchPathW(LPCWSTR lpPath, LPCWSTR lpFileName, LPCWSTR lpExtension,
373 DWORD nBufferLength, LPWSTR lpBuffer, LPWSTR *lpFilePart)
374{
375 char *asciipath, *asciifile, *asciiext, *asciibuffer, *asciipart;
376 DWORD rc;
377
378 dprintf(("KERNEL32: SearchPathW"));
379 asciibuffer = (char *)malloc(nBufferLength+1);
380 asciipath = UnicodeToAsciiString((LPWSTR)lpPath);
381 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
382 asciiext = UnicodeToAsciiString((LPWSTR)lpFileName);
383 rc = O32_SearchPath(asciipath, asciifile, asciiext, nBufferLength, asciibuffer, &asciipart);
384
385 if(rc) {
386 AsciiToUnicode(asciibuffer, lpBuffer);
387 *lpFilePart = lpBuffer + ((int)asciipart - (int)asciibuffer);
388 }
389 FreeAsciiString(asciiext);
390 FreeAsciiString(asciifile);
391 FreeAsciiString(asciipath);
392 free(asciibuffer);
393 return(rc);
394}
395//******************************************************************************
396//******************************************************************************
397DWORD WIN32API GetFileAttributesA(LPCSTR lpszFileName)
398{
399 DWORD rc;
400
401 rc = O32_GetFileAttributes((LPSTR)lpszFileName);
402 dprintf(("KERNEL32: GetFileAttributes of %s returned %d\n", lpszFileName, rc));
403 return(rc);
404}
405//******************************************************************************
406//******************************************************************************
407DWORD WIN32API GetFileAttributesW(LPCWSTR arg1)
408{
409 DWORD rc;
410 char *astring;
411
412 dprintf(("KERNEL32: GetFileAttributesW\n"));
413 astring = UnicodeToAsciiString((LPWSTR)arg1);
414 rc = O32_GetFileAttributes(astring);
415 FreeAsciiString(astring);
416 return(rc);
417}
418//******************************************************************************
419//******************************************************************************
420BOOL WIN32API SetFileAttributesA(LPCSTR arg1, DWORD arg2)
421{
422 dprintf(("KERNEL32: SetFileAttributes of %s\n", arg1));
423 return O32_SetFileAttributes(arg1, arg2);
424}
425//******************************************************************************
426//******************************************************************************
427BOOL WIN32API SetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes)
428{
429 char *asciifile;
430 BOOL rc;
431
432 dprintf(("KERNEL32: SetFileAttributesW\n"));
433 asciifile = UnicodeToAsciiString((LPWSTR)lpFileName);
434 rc = O32_SetFileAttributes(asciifile, dwFileAttributes);
435 FreeAsciiString(asciifile);
436 return(rc);
437}
438//******************************************************************************
439//******************************************************************************
440DWORD WIN32API GetFullPathNameA(LPCSTR arg1, DWORD arg2, LPSTR arg3, LPSTR *arg4)
441{
442 dprintf(("KERNEL32: GetFullPathName %s\n", arg1));
443 return O32_GetFullPathName(arg1, arg2, arg3, arg4);
444}
445//******************************************************************************
446//******************************************************************************
447DWORD WIN32API GetFullPathNameW(LPCWSTR lpFileName, DWORD nBufferLength,
448 LPWSTR lpBuffer, LPWSTR *lpFilePart)
449{
450 char *astring, *asciibuffer, *asciipart;
451 DWORD rc;
452
453 dprintf(("KERNEL32: GetFullPathNameW\n"));
454 asciibuffer = (char *)malloc(nBufferLength+1);
455 astring = UnicodeToAsciiString((LPWSTR)lpFileName);
456
457 rc = O32_GetFullPathName(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 *lpFilePart = lpBuffer + ((int)asciipart - (int)asciibuffer);
471
472 FreeAsciiString(astring);
473 free(asciibuffer);
474 return(rc);
475}
476//******************************************************************************
477//******************************************************************************
478BOOL WIN32API LockFile( HANDLE arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5)
479{
480 dprintf(("KERNEL32: LockFile\n"));
481 return O32_LockFile(arg1, arg2, arg3, arg4, arg5);
482}
483
484
485/*****************************************************************************
486 * Name : BOOL LockFileEx
487 * Purpose : The LockFileEx function locks a byte range within an open file for shared or exclusive access.
488 * Parameters: HANDLE hFile handle of file to lock
489 * DWORD dwFlags functional behavior modification flags
490 * DWORD dwReserved reserved, must be set to zero
491 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
492 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
493 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
494 * Variables :
495 * Result : TRUE / FALSE
496 * Remark :
497 * Status : UNTESTED STUB
498 *
499 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
500 *****************************************************************************/
501
502BOOL WIN32API LockFileEx(HANDLE hFile,
503 DWORD dwFlags,
504 DWORD dwReserved,
505 DWORD nNumberOfBytesToLockLow,
506 DWORD nNumberOfBytesToLockHigh,
507 LPOVERLAPPED LPOVERLAPPED)
508{
509 dprintf(("Kernel32: LockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
510 hFile,
511 dwFlags,
512 dwReserved,
513 nNumberOfBytesToLockLow,
514 nNumberOfBytesToLockHigh,
515 LPOVERLAPPED));
516
517 return(O32_LockFile(hFile,
518 LPOVERLAPPED->Offset,
519 LPOVERLAPPED->OffsetHigh,
520 nNumberOfBytesToLockLow,
521 nNumberOfBytesToLockHigh));
522}
523
524
525
526
527//******************************************************************************
528//******************************************************************************
529BOOL WIN32API MoveFileA( LPCSTR arg1, LPCSTR arg2)
530{
531 dprintf(("KERNEL32: MoveFileA\n"));
532 return O32_MoveFile(arg1, arg2);
533}
534//******************************************************************************
535//******************************************************************************
536BOOL WIN32API MoveFileExA(LPCSTR arg1,
537 LPCSTR arg2,
538 DWORD fdwFlags)
539{
540 dprintf(("KERNEL32: MoveFileExA %s to %s, not complete!\n", arg1, arg2));
541 return O32_MoveFile(arg1, arg2);
542}
543//******************************************************************************
544//******************************************************************************
545BOOL WIN32API MoveFileW(LPCWSTR lpSrc, LPCWSTR lpDest)
546{
547 char *asciisrc, *asciidest;
548 BOOL rc;
549
550 dprintf(("KERNEL32: MoveFileW\n"));
551 asciisrc = UnicodeToAsciiString((LPWSTR)lpSrc);
552 asciidest = UnicodeToAsciiString((LPWSTR)lpDest);
553 rc = O32_MoveFile(asciisrc, asciidest);
554 FreeAsciiString(asciisrc);
555 FreeAsciiString(asciidest);
556 return(rc);
557}
558//******************************************************************************
559//******************************************************************************
560BOOL WIN32API MoveFileExW(LPCWSTR arg1,
561 LPCWSTR arg2,
562 DWORD fdwFlags)
563{
564 dprintf(("KERNEL32: MoveFileExW %s to %s, not complete!\n", arg1, arg2));
565 return MoveFileW(arg1, arg2);
566}
567//******************************************************************************
568/*****************************************************************************
569 * Name : HFILE WIN32API OpenFile
570 * Purpose : forward OpenFile to Open32
571 * Parameters:
572 * Variables :
573 * Result : API returncode
574 * Remark : modified for handle translation support
575 * Status : @@@PH verify if 0 is a valid "invalid handle" :)
576 *
577 * Author : Patrick Haller [Fri, 1998/06/12 02:53]
578 *****************************************************************************/
579
580HFILE WIN32API OpenFile(LPCSTR arg1,
581 OFSTRUCT *arg2,
582 UINT arg3)
583{
584 HFILE hFile;
585 ULONG ulWindowsHandle; /* translated windows handle */
586
587 dprintf(("KERNEL32: OpenFile(%s, %08xh, %08xh)\n",
588 arg1,
589 arg2,
590 arg3));
591
592 hFile = O32_OpenFile(arg1, /* call open32 */
593 arg2,
594 arg3);
595 if (hFile != 0) /* check if handle is valid */
596 {
597 if (HMHandleAllocate(&ulWindowsHandle, /* allocate translation handle */
598 hFile) == NO_ERROR)
599 return (ulWindowsHandle);
600 else
601 return (0);
602 }
603 else
604 return (0);
605}
606//******************************************************************************
607//******************************************************************************
608BOOL WIN32API UnlockFile( HANDLE arg1, DWORD arg2, DWORD arg3, DWORD arg4, DWORD arg5)
609{
610 dprintf(("KERNEL32: UnlockFile\n"));
611 return O32_UnlockFile(arg1, arg2, arg3, arg4, arg5);
612}
613
614
615/*****************************************************************************
616 * Name : BOOL UnlockFileEx
617 * Purpose : The UnlockFileEx function unlocks a previously locked byte range in an open file.
618 * Parameters: HANDLE hFile handle of file to lock
619 * DWORD dwReserved reserved, must be set to zero
620 * DWORD nNumberOfBytesToLockLow low-order 32 bits of length to lock
621 * DWORD nNumberOfBytesToLockHigh high-order 32 bits of length to lock
622 * LPOVERLAPPED LPOVERLAPPED addr. of structure with lock region start offset
623 * Variables :
624 * Result : TRUE / FALSE
625 * Remark :
626 * Status : UNTESTED STUB
627 *
628 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
629 *****************************************************************************/
630
631BOOL WIN32API UnlockFileEx(HANDLE hFile,
632 DWORD dwReserved,
633 DWORD nNumberOfBytesToLockLow,
634 DWORD nNumberOfBytesToLockHigh,
635 LPOVERLAPPED LPOVERLAPPED)
636{
637 dprintf(("Kernel32: UnlockFileEx(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh)\n",
638 hFile,
639 dwReserved,
640 nNumberOfBytesToLockLow,
641 nNumberOfBytesToLockHigh,
642 LPOVERLAPPED));
643
644 return(O32_UnlockFile(hFile,
645 LPOVERLAPPED->Offset,
646 LPOVERLAPPED->OffsetHigh,
647 nNumberOfBytesToLockLow,
648 nNumberOfBytesToLockHigh));
649}
650//******************************************************************************
651//******************************************************************************
652DWORD WIN32API GetShortPathNameA(LPCTSTR lpszLongPath, LPTSTR lpszShortPath,
653 DWORD cchBuffer)
654{
655 int length;
656
657 dprintf(("KERNEL32: GetShortPathNameA of %s, just copying it\n", lpszLongPath));
658 length = strlen(lpszLongPath) + 1;
659 if(length > cchBuffer) {
660 *lpszShortPath = 0;
661 return(length);
662 }
663 memcpy(lpszShortPath, lpszLongPath, length);
664 return(length-1);
665}
666//******************************************************************************
667//******************************************************************************
668DWORD WIN32API GetShortPathNameW(LPCWSTR lpszLongPath, LPWSTR lpszShortPath,
669 DWORD cchBuffer)
670{
671 int length;
672
673 dprintf(("KERNEL32: GetShortPathNameW; just copying it\n"));
674 length = UniStrlen((UniChar*)lpszLongPath) + 1;
675 if(length > cchBuffer) {
676 *lpszShortPath = 0;
677 return(length);
678 }
679 memcpy(lpszShortPath, lpszLongPath, length*sizeof(USHORT));
680 return(length-1);
681}
682//******************************************************************************
683//******************************************************************************
684HANDLE WIN32API FindFirstChangeNotificationA(LPCSTR lpPathName, BOOL bWatchSubtree,
685 DWORD dwNotifyFilter)
686{
687 dprintf(("KERNEL32: FindFirstChangeNotificationA, Not implemented\n"));
688 return(0);
689}
690//******************************************************************************
691//******************************************************************************
692BOOL WIN32API FindNextChangeNotification(HANDLE hChange)
693{
694 dprintf(("KERNEL32: FindNextChangeNotification, Not implemented\n"));
695 return(0);
696}
697//******************************************************************************
698//******************************************************************************
699VOID WIN32API SetFileApisToANSI( VOID ) /*PLF Tue 98-02-10 00:52:22*/
700{
701 dprintf(("SetFileApisToANSI() stub\n"));
702}
703
704/*****************************************************************************
705 * Name : DWORD GetCompressedFileSizeA
706 * Purpose : The GetCompressedFileSizeA function obtains the compressed
707 * size, in bytes, of a specified file.
708 * Parameters: LPCTSTR lpFileName, // pointer to name of file
709 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
710 * high-order doubleword of file size
711 * Variables :
712 * Result : size of compressed file
713 * Remark :
714 * Status : UNTESTED
715 *
716 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
717 *****************************************************************************/
718
719DWORD WIN32API GetCompressedFileSizeA(LPCTSTR lpFileName,
720 LPDWORD lpFileSizeHigh)
721{
722 dprintf(("KERNEL32: GetCompressedFileSizeA (%s, %08xh) not implemented.\n",
723 lpFileName,
724 lpFileSizeHigh));
725
726 /* PH: simply return the standard filesize */
727 return 0;
728}
729
730
731/*****************************************************************************
732 * Name : DWORD GetCompressedFileSizeW
733 * Purpose : The GetCompressedFileSizeE function obtains the compressed
734 * size, in bytes, of a specified file.
735 * Parameters: LPCWSTR lpFileName, // pointer to name of file
736 * LPDWORD lpFileSizeHigh // pointer to DWORD to receive
737 * high-order doubleword of file size
738 * Variables :
739 * Result : size of compressed file
740 * Remark :
741 * Status : UNTESTED
742 *
743 * Author : Patrick Haller [Mon, 1998/06/15 08:00]
744 *****************************************************************************/
745
746DWORD WIN32API GetCompressedFileSizeW(LPCWSTR lpFileName,
747 LPDWORD lpFileSizeHigh)
748{
749 LPCTSTR lpAsciiFileName; /* converted filename */
750 DWORD rc; /* function result */
751
752 dprintf(("KERNEL32: GetCompressedFileSizeW (%s, %08xh)\n",
753 lpFileName,
754 lpFileSizeHigh));
755
756 lpAsciiFileName = UnicodeToAsciiString( (LPWSTR) lpFileName);
757
758 rc = GetCompressedFileSizeA(lpAsciiFileName,
759 lpFileSizeHigh);
760
761 FreeAsciiString( (char *) lpAsciiFileName);
762
763 return (rc); /* return result */
764}
Note: See TracBrowser for help on using the repository browser.