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

Last change on this file since 4 was 4, checked in by ktk, 26 years ago

Import

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