ReactOS 0.4.16-dev-1408-gbc64f3a
file.c
Go to the documentation of this file.
1/*
2 * File handling functions
3 *
4 * Copyright 1993 John Burton
5 * Copyright 1996, 2004 Alexandre Julliard
6 * Copyright 2008 Jeff Zaroyko
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#include <stdarg.h>
24#include <stdio.h>
25
26#include "winerror.h"
27#include "ntstatus.h"
28#define WIN32_NO_STATUS
29#include "windef.h"
30#include "winbase.h"
31#include "winnls.h"
32#include "winternl.h"
33#include "winioctl.h"
34#include "wincon.h"
35#include "fileapi.h"
36#include "shlwapi.h"
37#include "ddk/ntddk.h"
38#include "ddk/ntddser.h"
39#include "ioringapi.h"
40
41#include "kernelbase.h"
42#include "wine/exception.h"
43#include "wine/debug.h"
44
46
47/* info structure for FindFirstFile handle */
48typedef struct
49{
50 DWORD magic; /* magic number */
51 HANDLE handle; /* handle to directory */
52 CRITICAL_SECTION cs; /* crit section protecting this structure */
53 FINDEX_SEARCH_OPS search_op; /* Flags passed to FindFirst. */
54 FINDEX_INFO_LEVELS level; /* Level passed to FindFirst */
55 UNICODE_STRING path; /* NT path used to open the directory */
56 BOOL is_root; /* is directory the root of the drive? */
57 UINT data_pos; /* current position in dir data */
58 UINT data_len; /* length of dir data */
59 UINT data_size; /* size of data buffer, or 0 when everything has been read */
60 BYTE data[1]; /* directory data */
62
63#define FIND_FIRST_MAGIC 0xc0ffee11
64
66
67const WCHAR windows_dir[] = L"C:\\windows";
68const WCHAR system_dir[] = L"C:\\windows\\system32";
69
71
72
74{
76 func( RtlNtStatusToDosError( io->Status ), io->Information, (LPOVERLAPPED)io );
77}
78
80{
81 switch (machine)
82 {
83 case IMAGE_FILE_MACHINE_TARGET_HOST: return system_dir;
84 case IMAGE_FILE_MACHINE_I386: return L"C:\\windows\\syswow64";
85 case IMAGE_FILE_MACHINE_ARMNT: return L"C:\\windows\\sysarm32";
86 default: return NULL;
87 }
88}
89
90
91/***********************************************************************
92 * Operations on file names
93 ***********************************************************************/
94
95
96/***********************************************************************
97 * contains_path
98 *
99 * Check if the file name contains a path; helper for SearchPathW.
100 * A relative path is not considered a path unless it starts with ./ or ../
101 */
102static inline BOOL contains_path( const WCHAR *name )
103{
105 if (name[0] != '.') return FALSE;
106 if (name[1] == '/' || name[1] == '\\') return TRUE;
107 return (name[1] == '.' && (name[2] == '/' || name[2] == '\\'));
108}
109
110
111/***********************************************************************
112 * add_boot_rename_entry
113 *
114 * Adds an entry to the registry that is loaded when windows boots and
115 * checks if there are some files to be removed or renamed/moved.
116 * <fn1> has to be valid and <fn2> may be NULL. If both pointers are
117 * non-NULL then the file is moved, otherwise it is deleted. The
118 * entry of the registry key is always appended with two zero
119 * terminated strings. If <fn2> is NULL then the second entry is
120 * simply a single 0-byte. Otherwise the second filename goes
121 * there. The entries are prepended with \??\ before the path and the
122 * second filename gets also a '!' as the first character if
123 * MOVEFILE_REPLACE_EXISTING is set. After the final string another
124 * 0-byte follows to indicate the end of the strings.
125 * i.e.:
126 * \??\D:\test\file1[0]
127 * !\??\D:\test\file1_renamed[0]
128 * \??\D:\Test|delete[0]
129 * [0] <- file is to be deleted, second string empty
130 * \??\D:\test\file2[0]
131 * !\??\D:\test\file2_renamed[0]
132 * [0] <- indicates end of strings
133 *
134 * or:
135 * \??\D:\test\file1[0]
136 * !\??\D:\test\file1_renamed[0]
137 * \??\D:\Test|delete[0]
138 * [0] <- file is to be deleted, second string empty
139 * [0] <- indicates end of strings
140 *
141 */
143{
144 static const int info_size = FIELD_OFFSET( KEY_VALUE_PARTIAL_INFORMATION, Data );
145
147 UNICODE_STRING session_manager = RTL_CONSTANT_STRING( L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Session Manager" );
148 UNICODE_STRING pending_file_rename_operations = RTL_CONSTANT_STRING( L"PendingFileRenameOperations" );
149 UNICODE_STRING source_name, dest_name;
151 BOOL rc = FALSE;
152 HANDLE key = 0;
153 DWORD len1, len2;
154 DWORD size = 0;
155 BYTE *buffer = NULL;
156 WCHAR *p;
157
158 if (!RtlDosPathNameToNtPathName_U( source, &source_name, NULL, NULL ))
159 {
161 return FALSE;
162 }
163 dest_name.Buffer = NULL;
164 if (dest && !RtlDosPathNameToNtPathName_U( dest, &dest_name, NULL, NULL ))
165 {
166 RtlFreeUnicodeString( &source_name );
168 return FALSE;
169 }
170
171 attr.Length = sizeof(attr);
172 attr.RootDirectory = 0;
173 attr.ObjectName = &session_manager;
174 attr.Attributes = 0;
175 attr.SecurityDescriptor = NULL;
176 attr.SecurityQualityOfService = NULL;
177
179 {
180 RtlFreeUnicodeString( &source_name );
181 RtlFreeUnicodeString( &dest_name );
182 return FALSE;
183 }
184
185 len1 = source_name.Length + sizeof(WCHAR);
186 if (dest)
187 {
188 len2 = dest_name.Length + sizeof(WCHAR);
190 len2 += sizeof(WCHAR); /* Plus 1 because of the leading '!' */
191 }
192 else len2 = sizeof(WCHAR); /* minimum is the 0 characters for the empty second string */
193
194 /* First we check if the key exists and if so how many bytes it already contains. */
195 if (NtQueryValueKey( key, &pending_file_rename_operations, KeyValuePartialInformation,
197 {
198 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size + len1 + len2 + sizeof(WCHAR) ))) goto done;
199 if (NtQueryValueKey( key, &pending_file_rename_operations, KeyValuePartialInformation, buffer, size, &size )) goto done;
201 if (info->Type != REG_MULTI_SZ) goto done;
202 if (size > sizeof(info)) size -= sizeof(WCHAR); /* remove terminating null (will be added back later) */
203 }
204 else
205 {
206 size = info_size;
207 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size + len1 + len2 + sizeof(WCHAR) ))) goto done;
208 }
209
210 memcpy( buffer + size, source_name.Buffer, len1 );
211 size += len1;
212 p = (WCHAR *)(buffer + size);
213 if (dest)
214 {
215 if (flags & MOVEFILE_REPLACE_EXISTING) *p++ = '!';
216 memcpy( p, dest_name.Buffer, len2 );
217 size += len2;
218 }
219 else
220 {
221 *p = 0;
222 size += sizeof(WCHAR);
223 }
224
225 /* add final null */
226 p = (WCHAR *)(buffer + size);
227 *p = 0;
228 size += sizeof(WCHAR);
229 rc = !NtSetValueKey( key, &pending_file_rename_operations, 0, REG_MULTI_SZ, buffer + info_size, size - info_size );
230
231 done:
232 RtlFreeUnicodeString( &source_name );
233 RtlFreeUnicodeString( &dest_name );
234 if (key) NtClose(key);
236 return rc;
237}
238
239
240/***********************************************************************
241 * append_ext
242 */
243static WCHAR *append_ext( const WCHAR *name, const WCHAR *ext )
244{
245 const WCHAR *p;
246 WCHAR *ret;
247 DWORD len;
248
249 if (!ext) return NULL;
250 p = wcsrchr( name, '.' );
251 if (p && !wcschr( p, '/' ) && !wcschr( p, '\\' )) return NULL;
252
253 len = lstrlenW( name ) + lstrlenW( ext );
254 if ((ret = RtlAllocateHeap( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) )))
255 {
256 lstrcpyW( ret, name );
257 lstrcatW( ret, ext );
258 }
259 return ret;
260}
261
262
263/***********************************************************************
264 * find_actctx_dllpath
265 *
266 * Find the path (if any) of the dll from the activation context.
267 * Returned path doesn't include a name.
268 */
270{
271 ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info;
272 ACTCTX_SECTION_KEYED_DATA data;
275 SIZE_T needed, size = 1024;
276 WCHAR *p;
277
279 data.cbSize = sizeof(data);
280 status = RtlFindActivationContextSectionString( FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
281 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION,
282 &nameW, &data );
283 if (status != STATUS_SUCCESS) return status;
284
285 for (;;)
286 {
287 if (!(info = RtlAllocateHeap( GetProcessHeap(), 0, size )))
288 {
290 goto done;
291 }
292 status = RtlQueryInformationActivationContext( 0, data.hActCtx, &data.ulAssemblyRosterIndex,
293 AssemblyDetailedInformationInActivationContext,
294 info, size, &needed );
295 if (status == STATUS_SUCCESS) break;
296 if (status != STATUS_BUFFER_TOO_SMALL) goto done;
298 size = needed;
299 /* restart with larger buffer */
300 }
301
302 if (!info->lpAssemblyManifestPath)
303 {
305 goto done;
306 }
307
308 if ((p = wcsrchr( info->lpAssemblyManifestPath, '\\' )))
309 {
310 DWORD dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
311
312 p++;
313 if (!dirlen ||
314 CompareStringOrdinal( p, dirlen, info->lpAssemblyDirectoryName, dirlen, TRUE ) != CSTR_EQUAL ||
315 wcsicmp( p + dirlen, L".manifest" ))
316 {
317 /* manifest name does not match directory name, so it's not a global
318 * windows/winsxs manifest; use the manifest directory name instead */
319 dirlen = p - info->lpAssemblyManifestPath;
320 needed = (dirlen + 1) * sizeof(WCHAR);
321 if (!(*path = p = HeapAlloc( GetProcessHeap(), 0, needed )))
322 {
324 goto done;
325 }
326 memcpy( p, info->lpAssemblyManifestPath, dirlen * sizeof(WCHAR) );
327 *(p + dirlen) = 0;
328 goto done;
329 }
330 }
331
332 if (!info->lpAssemblyDirectoryName)
333 {
335 goto done;
336 }
337
338 needed = sizeof(L"C:\\windows\\winsxs\\") + info->ulAssemblyDirectoryNameLength + sizeof(WCHAR);
339
340 if (!(*path = p = RtlAllocateHeap( GetProcessHeap(), 0, needed )))
341 {
343 goto done;
344 }
345 lstrcpyW( p, L"C:\\windows\\winsxs\\" );
346 p += lstrlenW(p);
347 memcpy( p, info->lpAssemblyDirectoryName, info->ulAssemblyDirectoryNameLength );
348 p += info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
349 *p++ = '\\';
350 *p = 0;
351done:
354 return status;
355}
356
357
358/***********************************************************************
359 * copy_filename
360 */
362{
363 UINT ret = lstrlenW( name ) + 1;
364 if (buffer && len >= ret)
365 {
366 lstrcpyW( buffer, name );
367 ret--;
368 }
369 return ret;
370}
371
372
373/***********************************************************************
374 * copy_filename_WtoA
375 *
376 * copy a file name back to OEM/Ansi, but only if the buffer is large enough
377 */
379{
381 DWORD ret;
382
384
386 if (buffer && ret <= len)
387 {
389
390 str.Buffer = buffer;
391 str.MaximumLength = min( len, UNICODE_STRING_MAX_CHARS );
392 if (oem_file_apis)
394 else
396 ret = str.Length; /* length without terminating 0 */
397 }
398 return ret;
399}
400
401
402/***********************************************************************
403 * file_name_AtoW
404 *
405 * Convert a file name to Unicode, taking into account the OEM/Ansi API mode.
406 *
407 * If alloc is FALSE uses the TEB static buffer, so it can only be used when
408 * there is no possibility for the function to do that twice, taking into
409 * account any called function.
410 */
412{
414 UNICODE_STRING strW, *pstrW;
416
418 pstrW = alloc ? &strW : &NtCurrentTeb()->StaticUnicodeString;
419 if (oem_file_apis)
421 else
423 if (status == STATUS_SUCCESS) return pstrW->Buffer;
424
427 else
429 return NULL;
430}
431
432
433/***********************************************************************
434 * file_name_WtoA
435 *
436 * Convert a file name back to OEM/Ansi. Returns number of bytes copied.
437 */
439{
440 DWORD ret;
441
442 if (srclen < 0) srclen = lstrlenW( src ) + 1;
443 if (!destlen)
444 {
445 if (oem_file_apis)
446 {
448 strW.Buffer = (WCHAR *)src;
449 strW.Length = srclen * sizeof(WCHAR);
451 }
452 else
454 }
455 else
456 {
457 if (oem_file_apis)
458 RtlUnicodeToOemN( dest, destlen, &ret, src, srclen * sizeof(WCHAR) );
459 else
460 RtlUnicodeToMultiByteN( dest, destlen, &ret, src, srclen * sizeof(WCHAR) );
461 }
462 return ret;
463}
464
465
466/***********************************************************************
467 * is_same_file
468 */
470{
471 FILE_OBJECTID_BUFFER id1, id2;
473
474 return (!NtFsControlFile( h1, 0, NULL, NULL, &io, FSCTL_GET_OBJECT_ID, NULL, 0, &id1, sizeof(id1) ) &&
475 !NtFsControlFile( h2, 0, NULL, NULL, &io, FSCTL_GET_OBJECT_ID, NULL, 0, &id2, sizeof(id2) ) &&
476 !memcmp( &id1.ObjectId, &id2.ObjectId, sizeof(id1.ObjectId) ));
477}
478
479
480/******************************************************************************
481 * AreFileApisANSI (kernelbase.@)
482 */
484{
485 return !oem_file_apis;
486}
487
488/******************************************************************************
489 * copy_file
490 */
491static BOOL copy_file( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDED_PARAMETERS *params )
492{
493 DWORD flags = params ? params->dwCopyFlags : 0;
494 BOOL *cancel_ptr = params ? params->pfCancel : NULL;
495 PCOPYFILE2_PROGRESS_ROUTINE progress = params ? params->pProgressRoutine : NULL;
496
497 static const int buffer_size = 65536;
498 HANDLE h1, h2;
501 DWORD count;
502 BOOL ret = FALSE;
503 char *buffer;
504
505 if (cancel_ptr)
506 FIXME("pfCancel is not supported\n");
507 if (progress)
508 FIXME("PCOPYFILE2_PROGRESS_ROUTINE is not supported\n");
509
510 if (!source || !dest)
511 {
513 return FALSE;
514 }
515 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, buffer_size )))
516 {
518 return FALSE;
519 }
520
521 TRACE("%s -> %s, %lx\n", debugstr_w(source), debugstr_w(dest), flags);
522
524 FIXME("COPY_FILE_RESTARTABLE is not supported\n");
525 if (flags & COPY_FILE_COPY_SYMLINK)
526 FIXME("COPY_FILE_COPY_SYMLINK is not supported\n");
528 FIXME("COPY_FILE_OPEN_SOURCE_FOR_WRITE is not supported\n");
529
532 {
533 WARN("Unable to open source %s\n", debugstr_w(source));
535 return FALSE;
536 }
537
539 {
540 WARN("GetFileInformationByHandle returned error for %s\n", debugstr_w(source));
542 CloseHandle( h1 );
543 return FALSE;
544 }
545
547 {
548 BOOL same_file = FALSE;
550 if (h2 != INVALID_HANDLE_VALUE)
551 {
552 same_file = is_same_file( h1, h2 );
553 CloseHandle( h2 );
554 }
555 if (same_file)
556 {
558 CloseHandle( h1 );
560 return FALSE;
561 }
562 }
563
566 info.FileAttributes, h1 )) == INVALID_HANDLE_VALUE)
567 {
568 WARN("Unable to open dest %s\n", debugstr_w(dest));
570 CloseHandle( h1 );
571 return FALSE;
572 }
573
574 while (ReadFile( h1, buffer, buffer_size, &count, NULL ) && count)
575 {
576 char *p = buffer;
577 while (count != 0)
578 {
579 DWORD res;
580 if (!WriteFile( h2, p, count, &res, NULL ) || !res) goto done;
581 p += res;
582 count -= res;
583 }
584 }
585 ret = TRUE;
586done:
587 /* Maintain the timestamp of source file to destination file and read-only attribute */
588 info.FileAttributes &= FILE_ATTRIBUTE_READONLY;
591 CloseHandle( h1 );
592 CloseHandle( h2 );
593 if (ret) SetLastError( 0 );
594 return ret;
595}
596
597/***********************************************************************
598 * CopyFile2 (kernelbase.@)
599 */
600HRESULT WINAPI CopyFile2( const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDED_PARAMETERS *params )
601{
603}
604
605
606/***********************************************************************
607 * CopyFileExW (kernelbase.@)
608 */
610 void *param, BOOL *cancel_ptr, DWORD flags )
611{
612 COPYFILE2_EXTENDED_PARAMETERS params;
613
614 if (progress)
615 FIXME("LPPROGRESS_ROUTINE is not supported\n");
616 if (cancel_ptr)
617 FIXME("cancel_ptr is not supported\n");
618
619 params.dwSize = sizeof(params);
620 params.dwCopyFlags = flags;
621 params.pProgressRoutine = NULL;
622 params.pvCallbackContext = NULL;
623 params.pfCancel = NULL;
624
625 return copy_file( source, dest, &params );
626}
627
628
629/**************************************************************************
630 * CopyFileW (kernelbase.@)
631 */
633{
634 return CopyFileExW( source, dest, NULL, NULL, NULL, fail_if_exists ? COPY_FILE_FAIL_IF_EXISTS : 0 );
635}
636
637
638/***********************************************************************
639 * CreateDirectoryA (kernelbase.@)
640 */
642{
643 WCHAR *pathW;
644
645 if (!(pathW = file_name_AtoW( path, FALSE ))) return FALSE;
646 return CreateDirectoryW( pathW, sa );
647}
648
649
650/***********************************************************************
651 * CreateDirectoryW (kernelbase.@)
652 */
654{
656 UNICODE_STRING nt_name;
660
661 TRACE( "%s\n", debugstr_w(path) );
662
663 if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL ))
664 {
666 return FALSE;
667 }
668 attr.Length = sizeof(attr);
669 attr.RootDirectory = 0;
670 attr.Attributes = OBJ_CASE_INSENSITIVE;
671 attr.ObjectName = &nt_name;
672 attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
673 attr.SecurityQualityOfService = NULL;
674
679
680 RtlFreeUnicodeString( &nt_name );
681 return set_ntstatus( status );
682}
683
684
685/***********************************************************************
686 * CreateDirectoryEx (kernelbase.@)
687 */
690{
691 return CreateDirectoryW( path, sa );
692}
693
694
695/*************************************************************************
696 * CreateFile2 (kernelbase.@)
697 */
700{
701 static const DWORD attributes_mask = FILE_ATTRIBUTE_READONLY |
710 static const DWORD flags_mask = FILE_FLAG_BACKUP_SEMANTICS |
720
721 LPSECURITY_ATTRIBUTES sa = params ? params->lpSecurityAttributes : NULL;
722 HANDLE template = params ? params->hTemplateFile : NULL;
723 DWORD attributes = params ? params->dwFileAttributes : 0;
724 DWORD flags = params ? params->dwFileFlags : 0;
725
726 TRACE( "%s %#lx %#lx %#lx %p", debugstr_w(name), access, sharing, creation, params );
727 if (params) FIXME( "Ignoring extended parameters %p\n", params );
728
729 if (attributes & ~attributes_mask) FIXME( "unsupported attributes %#lx\n", attributes );
730 if (flags & ~flags_mask) FIXME( "unsupported flags %#lx\n", flags );
731 attributes &= attributes_mask;
732 flags &= flags_mask;
733
734 return CreateFileW( name, access, sharing, sa, creation, flags | attributes, template );
735}
736
737
738/*************************************************************************
739 * CreateFileA (kernelbase.@)
740 */
743 DWORD attributes, HANDLE template)
744{
745 WCHAR *nameW;
746
747 if ((GetVersion() & 0x80000000) && IsBadStringPtrA( name, -1 )) return INVALID_HANDLE_VALUE;
749 return CreateFileW( nameW, access, sharing, sa, creation, attributes, template );
750}
751
752static UINT get_nt_file_options( DWORD attributes )
753{
754 UINT options = 0;
755
756 if (attributes & FILE_FLAG_BACKUP_SEMANTICS)
758 else
760 if (attributes & FILE_FLAG_DELETE_ON_CLOSE)
762 if (attributes & FILE_FLAG_NO_BUFFERING)
764 if (!(attributes & FILE_FLAG_OVERLAPPED))
766 if (attributes & FILE_FLAG_RANDOM_ACCESS)
768 if (attributes & FILE_FLAG_SEQUENTIAL_SCAN)
770 if (attributes & FILE_FLAG_WRITE_THROUGH)
772 return options;
773}
774
775/*************************************************************************
776 * CreateFileW (kernelbase.@)
777 */
780 DWORD attributes, HANDLE template )
781{
786 HANDLE ret;
787 const WCHAR *vxd_name = NULL;
789
790 static const UINT nt_disposition[5] =
791 {
792 FILE_CREATE, /* CREATE_NEW */
793 FILE_OVERWRITE_IF, /* CREATE_ALWAYS */
794 FILE_OPEN, /* OPEN_EXISTING */
795 FILE_OPEN_IF, /* OPEN_ALWAYS */
796 FILE_OVERWRITE /* TRUNCATE_EXISTING */
797 };
798
799
800 /* sanity checks */
801
802 if (!filename || !filename[0])
803 {
806 }
807
808 TRACE( "%s %s%s%s%s%s%s%s creation %ld attributes 0x%lx\n", debugstr_w(filename),
809 (access & GENERIC_READ) ? "GENERIC_READ " : "",
810 (access & GENERIC_WRITE) ? "GENERIC_WRITE " : "",
811 (access & GENERIC_EXECUTE) ? "GENERIC_EXECUTE " : "",
812 !access ? "QUERY_ACCESS " : "",
813 (sharing & FILE_SHARE_READ) ? "FILE_SHARE_READ " : "",
814 (sharing & FILE_SHARE_WRITE) ? "FILE_SHARE_WRITE " : "",
815 (sharing & FILE_SHARE_DELETE) ? "FILE_SHARE_DELETE " : "",
816 creation, attributes);
817
818 if ((GetVersion() & 0x80000000) && !wcsncmp( filename, L"\\\\.\\", 4 ) &&
820 wcsnicmp( filename + 4, L"PIPE\\", 5 ) &&
821 wcsnicmp( filename + 4, L"MAILSLOT\\", 9 ))
822 {
823 vxd_name = filename + 4;
824 if (!creation) creation = OPEN_EXISTING;
825 }
826
827 if (creation < CREATE_NEW || creation > TRUNCATE_EXISTING)
828 {
831 }
832
834 {
837 }
838
839 /* now call NtCreateFile */
840
841 if (attributes & FILE_FLAG_DELETE_ON_CLOSE)
842 access |= DELETE;
843
844 attr.Length = sizeof(attr);
845 attr.RootDirectory = 0;
846 attr.Attributes = OBJ_CASE_INSENSITIVE;
847 attr.ObjectName = &nameW;
848 attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL;
849 if (attributes & SECURITY_SQOS_PRESENT)
850 {
851 qos.Length = sizeof(qos);
852 qos.ImpersonationLevel = (attributes >> 16) & 0x3;
854 qos.EffectiveOnly = (attributes & SECURITY_EFFECTIVE_ONLY) != 0;
855 attr.SecurityQualityOfService = &qos;
856 }
857 else
858 attr.SecurityQualityOfService = NULL;
859
860 if (sa && sa->bInheritHandle) attr.Attributes |= OBJ_INHERIT;
861
864 nt_disposition[creation - CREATE_NEW],
865 get_nt_file_options( attributes ), NULL, 0 );
866 if (status)
867 {
868 if (vxd_name && vxd_name[0])
869 {
870 static HANDLE (*vxd_open)(LPCWSTR,DWORD,SECURITY_ATTRIBUTES*);
871 if (!vxd_open) vxd_open = (void *)GetProcAddress( GetModuleHandleW(L"krnl386.exe16"),
872 "__wine_vxd_open" );
873 if (vxd_open && (ret = vxd_open( vxd_name, access, sa ))) goto done;
874 }
875
876 WARN("Unable to create file %s (status %lx)\n", debugstr_w(filename), status);
878
879 /* In the case file creation was rejected due to CREATE_NEW flag
880 * was specified and file with that name already exists, correct
881 * last error is ERROR_FILE_EXISTS and not ERROR_ALREADY_EXISTS.
882 * Note: RtlNtStatusToDosError is not the subject to blame here.
883 */
886 else
888 }
889 else
890 {
891 if ((creation == CREATE_ALWAYS && io.Information == FILE_OVERWRITTEN) ||
892 (creation == OPEN_ALWAYS && io.Information == FILE_OPENED))
894 else
895 SetLastError( 0 );
896 }
898
899 done:
901 TRACE("returning %p\n", ret);
902 return ret;
903}
904
905
906/*************************************************************************
907 * CreateHardLinkA (kernelbase.@)
908 */
911{
912 WCHAR *sourceW, *destW;
913 BOOL res;
914
915 if (!(sourceW = file_name_AtoW( source, TRUE ))) return FALSE;
916 if (!(destW = file_name_AtoW( dest, TRUE )))
917 {
919 return FALSE;
920 }
921 res = CreateHardLinkW( destW, sourceW, attr );
923 HeapFree( GetProcessHeap(), 0, destW );
924 return res;
925}
926
927
928/*************************************************************************
929 * CreateHardLinkW (kernelbase.@)
930 */
932{
933 UNICODE_STRING ntDest, ntSource;
937 BOOL ret = FALSE;
938 HANDLE file;
939 ULONG size;
940
941 TRACE( "(%s, %s, %p)\n", debugstr_w(dest), debugstr_w(source), sec_attr );
942
943 ntDest.Buffer = ntSource.Buffer = NULL;
944 if (!RtlDosPathNameToNtPathName_U( dest, &ntDest, NULL, NULL ) ||
946 {
948 goto done;
949 }
950
952 if (!(info = HeapAlloc( GetProcessHeap(), 0, size )))
953 {
955 goto done;
956 }
957
961 goto done;
962
963 info->ReplaceIfExists = FALSE;
964 info->RootDirectory = NULL;
965 info->FileNameLength = ntDest.Length;
966 memcpy( info->FileName, ntDest.Buffer, ntDest.Length );
968 NtClose( file );
969
970done:
971 RtlFreeUnicodeString( &ntSource );
972 RtlFreeUnicodeString( &ntDest );
974 return ret;
975}
976
977
978/*************************************************************************
979 * CreateSymbolicLinkW (kernelbase.@)
980 */
982{
983 FIXME( "(%s %s %ld): stub\n", debugstr_w(link), debugstr_w(target), flags );
984 return TRUE;
985}
986
987
988/***********************************************************************
989 * DeleteFileA (kernelbase.@)
990 */
992{
993 WCHAR *pathW;
994
995 if (!(pathW = file_name_AtoW( path, FALSE ))) return FALSE;
996 return DeleteFileW( pathW );
997}
998
999
1000/***********************************************************************
1001 * DeleteFileW (kernelbase.@)
1002 */
1004{
1008 HANDLE hFile;
1010
1011 TRACE( "%s\n", debugstr_w(path) );
1012
1014 {
1016 return FALSE;
1017 }
1018
1019 attr.Length = sizeof(attr);
1020 attr.RootDirectory = 0;
1021 attr.Attributes = OBJ_CASE_INSENSITIVE;
1022 attr.ObjectName = &nameW;
1023 attr.SecurityDescriptor = NULL;
1024 attr.SecurityQualityOfService = NULL;
1025
1030
1032 return set_ntstatus( status );
1033}
1034
1035
1036/****************************************************************************
1037 * FindCloseChangeNotification (kernelbase.@)
1038 */
1040{
1041 return CloseHandle( handle );
1042}
1043
1044
1045/****************************************************************************
1046 * FindFirstChangeNotificationA (kernelbase.@)
1047 */
1049{
1050 WCHAR *pathW;
1051
1052 if (!(pathW = file_name_AtoW( path, FALSE ))) return INVALID_HANDLE_VALUE;
1053 return FindFirstChangeNotificationW( pathW, subtree, filter );
1054}
1055
1056
1057/*
1058 * NtNotifyChangeDirectoryFile may write back to the IO_STATUS_BLOCK
1059 * asynchronously. We don't care about the contents, but it can't
1060 * be placed on the stack since it will go out of scope when we return.
1061 */
1063
1064/****************************************************************************
1065 * FindFirstChangeNotificationW (kernelbase.@)
1066 */
1068{
1069 UNICODE_STRING nt_name;
1073
1074 TRACE( "%s %d %lx\n", debugstr_w(path), subtree, filter );
1075
1076 if (!RtlDosPathNameToNtPathName_U( path, &nt_name, NULL, NULL ))
1077 {
1079 return handle;
1080 }
1081
1082 attr.Length = sizeof(attr);
1083 attr.RootDirectory = 0;
1084 attr.Attributes = OBJ_CASE_INSENSITIVE;
1085 attr.ObjectName = &nt_name;
1086 attr.SecurityDescriptor = NULL;
1087 attr.SecurityQualityOfService = NULL;
1088
1092 RtlFreeUnicodeString( &nt_name );
1093
1095
1097 if (status != STATUS_PENDING)
1098 {
1099 NtClose( handle );
1101 return INVALID_HANDLE_VALUE;
1102 }
1103 return handle;
1104}
1105
1106
1107/****************************************************************************
1108 * FindNextChangeNotification (kernelbase.@)
1109 */
1111{
1114 if (status == STATUS_PENDING) return TRUE;
1115 return set_ntstatus( status );
1116}
1117
1118
1119/******************************************************************************
1120 * FindFirstFileExA (kernelbase.@)
1121 */
1123 void *data, FINDEX_SEARCH_OPS search_op,
1124 void *filter, DWORD flags )
1125{
1126 HANDLE handle;
1127 WIN32_FIND_DATAA *dataA = data;
1128 WIN32_FIND_DATAW dataW;
1129 WCHAR *nameW;
1130
1132
1133 handle = FindFirstFileExW( nameW, level, &dataW, search_op, filter, flags );
1134 if (handle == INVALID_HANDLE_VALUE) return handle;
1135
1136 dataA->dwFileAttributes = dataW.dwFileAttributes;
1137 dataA->ftCreationTime = dataW.ftCreationTime;
1138 dataA->ftLastAccessTime = dataW.ftLastAccessTime;
1139 dataA->ftLastWriteTime = dataW.ftLastWriteTime;
1140 dataA->nFileSizeHigh = dataW.nFileSizeHigh;
1141 dataA->nFileSizeLow = dataW.nFileSizeLow;
1142 file_name_WtoA( dataW.cFileName, -1, dataA->cFileName, sizeof(dataA->cFileName) );
1143 file_name_WtoA( dataW.cAlternateFileName, -1, dataA->cAlternateFileName,
1144 sizeof(dataA->cAlternateFileName) );
1145 return handle;
1146}
1147
1148
1149/***********************************************************************
1150 * fixup_mask
1151 *
1152 * Fixup mask with wildcards for use with NtQueryDirectoryFile().
1153 */
1154static WCHAR *fixup_mask( const WCHAR *mask )
1155{
1156 unsigned int len = lstrlenW( mask ), i;
1157 BOOL no_ext;
1158 WCHAR *ret;
1159
1160 if (!(ret = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(*mask) ))) return NULL;
1161 memcpy( ret, mask, (len + 1) * sizeof(*mask) );
1162 if (!len) return ret;
1163 no_ext = ret[len - 1] == '.';
1164 while (len && (ret[len - 1] == '.' || ret[len - 1] == ' ')) --len;
1165
1166 for (i = 0; i < len; ++i)
1167 {
1168 if (ret[i] == '.' && (ret[i + 1] == '*' || ret[i + 1] == '?')) ret[i] = '\"';
1169 else if (ret[i] == '?') ret[i] = '>';
1170 }
1171 ret[len] = 0;
1172 if (no_ext && len && ret[len - 1] == '*') ret[len - 1] = '<';
1173 return ret;
1174}
1175
1176
1177/******************************************************************************
1178 * FindFirstFileExW (kernelbase.@)
1179 */
1181 LPVOID data, FINDEX_SEARCH_OPS search_op,
1183{
1184 WCHAR *mask;
1185 BOOL has_wildcard = FALSE;
1187 UNICODE_STRING nt_name;
1191 DWORD size, device = 0;
1192
1193 TRACE( "%s %d %p %d %p %lx\n", debugstr_w(filename), level, data, search_op, filter, flags );
1194
1196 {
1197 FIXME("flags not implemented 0x%08lx\n", flags );
1198 }
1199 if (search_op != FindExSearchNameMatch && search_op != FindExSearchLimitToDirectories)
1200 {
1201 FIXME( "search_op not implemented 0x%08x\n", search_op );
1203 return INVALID_HANDLE_VALUE;
1204 }
1206 {
1207 FIXME("info level %d not implemented\n", level );
1209 return INVALID_HANDLE_VALUE;
1210 }
1211
1212 if (!RtlDosPathNameToNtPathName_U( filename, &nt_name, &mask, NULL ))
1213 {
1215 return INVALID_HANDLE_VALUE;
1216 }
1217
1219 {
1220 WCHAR *dir = NULL;
1221
1222 /* we still need to check that the directory can be opened */
1223
1224 if (HIWORD(device))
1225 {
1226 if (!(dir = HeapAlloc( GetProcessHeap(), 0, HIWORD(device) + sizeof(WCHAR) )))
1227 {
1229 goto error;
1230 }
1232 dir[HIWORD(device)/sizeof(WCHAR)] = 0;
1233 }
1234 RtlFreeUnicodeString( &nt_name );
1235 if (!RtlDosPathNameToNtPathName_U( dir ? dir : L".", &nt_name, &mask, NULL ))
1236 {
1237 HeapFree( GetProcessHeap(), 0, dir );
1239 goto error;
1240 }
1241 HeapFree( GetProcessHeap(), 0, dir );
1242 size = 0;
1243 }
1244 else if (!mask || !*mask)
1245 {
1247 goto error;
1248 }
1249 else
1250 {
1251 nt_name.Length = (mask - nt_name.Buffer) * sizeof(WCHAR);
1252 has_wildcard = wcspbrk( mask, L"*?<>" ) != NULL;
1253 if (has_wildcard)
1254 {
1255 size = 8192;
1257 }
1258 else size = max_entry_size;
1259 }
1260
1262 {
1264 goto error;
1265 }
1266
1267 /* check if path is the root of the drive, skipping the \??\ prefix */
1268 info->is_root = FALSE;
1269 if (nt_name.Length >= 6 * sizeof(WCHAR) && nt_name.Buffer[5] == ':')
1270 {
1271 DWORD pos = 6;
1272 while (pos * sizeof(WCHAR) < nt_name.Length && nt_name.Buffer[pos] == '\\') pos++;
1273 info->is_root = (pos * sizeof(WCHAR) >= nt_name.Length);
1274 }
1275
1276 attr.Length = sizeof(attr);
1277 attr.RootDirectory = 0;
1278 attr.Attributes = OBJ_CASE_INSENSITIVE;
1279 attr.ObjectName = &nt_name;
1280 attr.SecurityDescriptor = NULL;
1281 attr.SecurityQualityOfService = NULL;
1282
1286 if (status != STATUS_SUCCESS)
1287 {
1290 else
1292 goto error;
1293 }
1294
1296 info->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": FIND_FIRST_INFO.cs");
1297 info->path = nt_name;
1298 info->magic = FIND_FIRST_MAGIC;
1299 info->data_pos = 0;
1300 info->data_len = 0;
1301 info->data_size = size;
1302 info->search_op = search_op;
1303 info->level = level;
1304
1305 if (device)
1306 {
1307 WIN32_FIND_DATAW *wfd = data;
1308
1309 memset( wfd, 0, sizeof(*wfd) );
1310 memcpy( wfd->cFileName, filename + HIWORD(device)/sizeof(WCHAR), LOWORD(device) );
1311 wfd->dwFileAttributes = FILE_ATTRIBUTE_ARCHIVE;
1312 CloseHandle( info->handle );
1313 info->handle = 0;
1314 }
1315 else
1316 {
1317 WCHAR *fixedup_mask = mask;
1318 UNICODE_STRING mask_str;
1319
1320 if (has_wildcard && !(fixedup_mask = fixup_mask( mask ))) status = STATUS_NO_MEMORY;
1321 else
1322 {
1323 RtlInitUnicodeString( &mask_str, fixedup_mask );
1324 status = NtQueryDirectoryFile( info->handle, 0, NULL, NULL, &io, info->data, info->data_size,
1326 }
1327 if (fixedup_mask != mask) HeapFree( GetProcessHeap(), 0, fixedup_mask );
1328 if (status)
1329 {
1330 FindClose( info );
1332 return INVALID_HANDLE_VALUE;
1333 }
1334
1335 info->data_len = io.Information;
1336 if (!has_wildcard) info->data_size = 0; /* we read everything */
1337
1338 if (!FindNextFileW( info, data ))
1339 {
1340 TRACE( "%s not found\n", debugstr_w(filename) );
1341 FindClose( info );
1343 return INVALID_HANDLE_VALUE;
1344 }
1345 if (!has_wildcard) /* we can't find two files with the same name */
1346 {
1347 CloseHandle( info->handle );
1348 info->handle = 0;
1349 }
1350 }
1351 return info;
1352
1353error:
1354 HeapFree( GetProcessHeap(), 0, info );
1355 RtlFreeUnicodeString( &nt_name );
1356 return INVALID_HANDLE_VALUE;
1357}
1358
1359
1360/******************************************************************************
1361 * FindFirstFileA (kernelbase.@)
1362 */
1364{
1366}
1367
1368
1369/******************************************************************************
1370 * FindFirstFileW (kernelbase.@)
1371 */
1373{
1375}
1376
1377/******************************************************************************
1378 * FindFirstFileNameW (kernelbase.@)
1379 */
1381{
1382 FIXME( "(%s, %lu, %p, %p): stub!\n", debugstr_w(file_name), flags, len, link_name );
1384 return INVALID_HANDLE_VALUE;
1385}
1386
1387/**************************************************************************
1388 * FindFirstStreamW (kernelbase.@)
1389 */
1390HANDLE WINAPI FindFirstStreamW( const WCHAR *filename, STREAM_INFO_LEVELS level, void *data, DWORD flags )
1391{
1392 FIXME("(%s, %d, %p, %lx): stub!\n", debugstr_w(filename), level, data, flags);
1394 return INVALID_HANDLE_VALUE;
1395}
1396
1397
1398/******************************************************************************
1399 * FindNextFileA (kernelbase.@)
1400 */
1402{
1403 WIN32_FIND_DATAW dataW;
1404
1405 if (!FindNextFileW( handle, &dataW )) return FALSE;
1406 data->dwFileAttributes = dataW.dwFileAttributes;
1407 data->ftCreationTime = dataW.ftCreationTime;
1408 data->ftLastAccessTime = dataW.ftLastAccessTime;
1409 data->ftLastWriteTime = dataW.ftLastWriteTime;
1410 data->nFileSizeHigh = dataW.nFileSizeHigh;
1411 data->nFileSizeLow = dataW.nFileSizeLow;
1412 file_name_WtoA( dataW.cFileName, -1, data->cFileName, sizeof(data->cFileName) );
1413 file_name_WtoA( dataW.cAlternateFileName, -1, data->cAlternateFileName,
1414 sizeof(data->cAlternateFileName) );
1415 return TRUE;
1416}
1417
1418
1419/******************************************************************************
1420 * FindNextFileW (kernelbase.@)
1421 */
1423{
1425 FILE_BOTH_DIR_INFORMATION *dir_info;
1426 BOOL ret = FALSE;
1428
1429 TRACE( "%p %p\n", handle, data );
1430
1431 if (!handle || handle == INVALID_HANDLE_VALUE || info->magic != FIND_FIRST_MAGIC)
1432 {
1434 return ret;
1435 }
1436
1438
1439 if (!info->handle) SetLastError( ERROR_NO_MORE_FILES );
1440 else for (;;)
1441 {
1442 if (info->data_pos >= info->data_len) /* need to read some more data */
1443 {
1445
1446 if (info->data_size)
1447 status = NtQueryDirectoryFile( info->handle, 0, NULL, NULL, &io, info->data, info->data_size,
1449 else
1451
1452 if (!set_ntstatus( status ))
1453 {
1455 {
1456 CloseHandle( info->handle );
1457 info->handle = 0;
1458 }
1459 break;
1460 }
1461 info->data_len = io.Information;
1462 info->data_pos = 0;
1463 }
1464
1465 dir_info = (FILE_BOTH_DIR_INFORMATION *)(info->data + info->data_pos);
1466
1467 if (dir_info->NextEntryOffset) info->data_pos += dir_info->NextEntryOffset;
1468 else info->data_pos = info->data_len;
1469
1470 /* don't return '.' and '..' in the root of the drive */
1471 if (info->is_root)
1472 {
1473 const WCHAR *file_name = dir_info->FileName;
1474 if (dir_info->FileNameLength == sizeof(WCHAR) && file_name[0] == '.') continue;
1475 if (dir_info->FileNameLength == 2 * sizeof(WCHAR) &&
1476 file_name[0] == '.' && file_name[1] == '.') continue;
1477 }
1478
1479 data->dwFileAttributes = dir_info->FileAttributes;
1480 data->ftCreationTime = *(FILETIME *)&dir_info->CreationTime;
1481 data->ftLastAccessTime = *(FILETIME *)&dir_info->LastAccessTime;
1482 data->ftLastWriteTime = *(FILETIME *)&dir_info->LastWriteTime;
1483 data->nFileSizeHigh = dir_info->EndOfFile.QuadPart >> 32;
1484 data->nFileSizeLow = (DWORD)dir_info->EndOfFile.QuadPart;
1485 data->dwReserved0 = 0;
1486 data->dwReserved1 = 0;
1487
1488 memcpy( data->cFileName, dir_info->FileName, dir_info->FileNameLength );
1489 data->cFileName[dir_info->FileNameLength/sizeof(WCHAR)] = 0;
1490
1491 if (info->level != FindExInfoBasic)
1492 {
1493 memcpy( data->cAlternateFileName, dir_info->ShortName, dir_info->ShortNameLength );
1494 data->cAlternateFileName[dir_info->ShortNameLength/sizeof(WCHAR)] = 0;
1495 }
1496 else
1497 data->cAlternateFileName[0] = 0;
1498
1499 TRACE( "returning %s (%s)\n",
1500 debugstr_w(data->cFileName), debugstr_w(data->cAlternateFileName) );
1501
1502 ret = TRUE;
1503 break;
1504 }
1505
1507 return ret;
1508}
1509
1510
1511/**************************************************************************
1512 * FindNextStreamW (kernelbase.@)
1513 */
1515{
1516 FIXME( "(%p, %p): stub!\n", handle, data );
1518 return FALSE;
1519}
1520
1521
1522/******************************************************************************
1523 * FindClose (kernelbase.@)
1524 */
1526{
1528
1530 {
1532 return FALSE;
1533 }
1534
1535 __TRY
1536 {
1537 if (info->magic == FIND_FIRST_MAGIC)
1538 {
1540 if (info->magic == FIND_FIRST_MAGIC) /* in case someone else freed it in the meantime */
1541 {
1542 info->magic = 0;
1543 if (info->handle) CloseHandle( info->handle );
1544 info->handle = 0;
1545 RtlFreeUnicodeString( &info->path );
1546 info->data_pos = 0;
1547 info->data_len = 0;
1549 info->cs.DebugInfo->Spare[0] = 0;
1551 HeapFree( GetProcessHeap(), 0, info );
1552 }
1553 }
1554 }
1556 {
1557 WARN( "illegal handle %p\n", handle );
1559 return FALSE;
1560 }
1561 __ENDTRY
1562
1563 return TRUE;
1564}
1565
1566
1567/******************************************************************************
1568 * GetCompressedFileSizeA (kernelbase.@)
1569 */
1571{
1572 WCHAR *nameW;
1573
1574 if (!(nameW = file_name_AtoW( name, FALSE ))) return INVALID_FILE_SIZE;
1575 return GetCompressedFileSizeW( nameW, size_high );
1576}
1577
1578
1579/******************************************************************************
1580 * GetCompressedFileSizeW (kernelbase.@)
1581 */
1583{
1584 UNICODE_STRING nt_name;
1588 HANDLE handle;
1589 DWORD ret;
1590
1591 TRACE("%s %p\n", debugstr_w(name), size_high);
1592
1593 if (!RtlDosPathNameToNtPathName_U( name, &nt_name, NULL, NULL ))
1594 {
1596 return INVALID_FILE_SIZE;
1597 }
1598
1599 attr.Length = sizeof(attr);
1600 attr.RootDirectory = 0;
1601 attr.Attributes = OBJ_CASE_INSENSITIVE;
1602 attr.ObjectName = &nt_name;
1603 attr.SecurityDescriptor = NULL;
1604 attr.SecurityQualityOfService = NULL;
1605
1607 RtlFreeUnicodeString( &nt_name );
1608 if (!set_ntstatus( status )) return INVALID_FILE_SIZE;
1609
1610 /* we don't support compressed files, simply return the file size */
1611 ret = GetFileSize( handle, size_high );
1612 NtClose( handle );
1613 return ret;
1614}
1615
1616
1617/***********************************************************************
1618 * GetCurrentDirectoryA (kernelbase.@)
1619 */
1621{
1622 WCHAR bufferW[MAX_PATH];
1623 DWORD ret;
1624
1625 if (buflen && buf && ((ULONG_PTR)buf >> 16) == 0)
1626 {
1627 /* Win9x catches access violations here, returning zero.
1628 * This behaviour resulted in some people not noticing
1629 * that they got the argument order wrong. So let's be
1630 * nice and fail gracefully if buf is invalid and looks
1631 * more like a buflen. */
1633 return 0;
1634 }
1635
1636 ret = RtlGetCurrentDirectory_U( sizeof(bufferW), bufferW );
1637 if (!ret) return 0;
1638 if (ret > sizeof(bufferW))
1639 {
1641 return 0;
1642 }
1643 return copy_filename_WtoA( bufferW, buf, buflen );
1644}
1645
1646
1647/***********************************************************************
1648 * GetCurrentDirectoryW (kernelbase.@)
1649 */
1651{
1652 return RtlGetCurrentDirectory_U( buflen * sizeof(WCHAR), buf ) / sizeof(WCHAR);
1653}
1654
1655
1656/**************************************************************************
1657 * GetFileAttributesA (kernelbase.@)
1658 */
1660{
1661 WCHAR *nameW;
1662
1664 return GetFileAttributesW( nameW );
1665}
1666
1667
1668/**************************************************************************
1669 * GetFileAttributesW (kernelbase.@)
1670 */
1672{
1674 UNICODE_STRING nt_name;
1677
1678 TRACE( "%s\n", debugstr_w(name) );
1679
1680 if (!RtlDosPathNameToNtPathName_U( name, &nt_name, NULL, NULL ))
1681 {
1684 }
1685
1686 attr.Length = sizeof(attr);
1687 attr.RootDirectory = 0;
1688 attr.Attributes = OBJ_CASE_INSENSITIVE;
1689 attr.ObjectName = &nt_name;
1690 attr.SecurityDescriptor = NULL;
1691 attr.SecurityQualityOfService = NULL;
1692
1694 RtlFreeUnicodeString( &nt_name );
1695
1696 if (status == STATUS_SUCCESS) return info.FileAttributes;
1697
1698 /* NtQueryAttributesFile fails on devices, but GetFileAttributesW succeeds */
1700
1703}
1704
1705
1706/**************************************************************************
1707 * GetFileAttributesExA (kernelbase.@)
1708 */
1710{
1711 WCHAR *nameW;
1712
1713 if (!(nameW = file_name_AtoW( name, FALSE ))) return FALSE;
1714 return GetFileAttributesExW( nameW, level, ptr );
1715}
1716
1717
1718/**************************************************************************
1719 * GetFileAttributesExW (kernelbase.@)
1720 */
1722{
1725 UNICODE_STRING nt_name;
1728
1729 TRACE("%s %d %p\n", debugstr_w(name), level, ptr);
1730
1732 {
1734 return FALSE;
1735 }
1736
1737 if (!RtlDosPathNameToNtPathName_U( name, &nt_name, NULL, NULL ))
1738 {
1740 return FALSE;
1741 }
1742
1743 attr.Length = sizeof(attr);
1744 attr.RootDirectory = 0;
1745 attr.Attributes = OBJ_CASE_INSENSITIVE;
1746 attr.ObjectName = &nt_name;
1747 attr.SecurityDescriptor = NULL;
1748 attr.SecurityQualityOfService = NULL;
1749
1751 RtlFreeUnicodeString( &nt_name );
1752 if (!set_ntstatus( status )) return FALSE;
1753
1754 data->dwFileAttributes = info.FileAttributes;
1755 data->ftCreationTime.dwLowDateTime = info.CreationTime.u.LowPart;
1756 data->ftCreationTime.dwHighDateTime = info.CreationTime.u.HighPart;
1757 data->ftLastAccessTime.dwLowDateTime = info.LastAccessTime.u.LowPart;
1758 data->ftLastAccessTime.dwHighDateTime = info.LastAccessTime.u.HighPart;
1759 data->ftLastWriteTime.dwLowDateTime = info.LastWriteTime.u.LowPart;
1760 data->ftLastWriteTime.dwHighDateTime = info.LastWriteTime.u.HighPart;
1761 data->nFileSizeLow = info.EndOfFile.u.LowPart;
1762 data->nFileSizeHigh = info.EndOfFile.u.HighPart;
1763 return TRUE;
1764}
1765
1766
1767/***********************************************************************
1768 * GetFinalPathNameByHandleA (kernelbase.@)
1769 */
1772{
1773 WCHAR *str;
1774 DWORD result, len;
1775
1776 TRACE( "(%p,%p,%ld,%lx)\n", file, path, count, flags);
1777
1779 if (len == 0) return 0;
1780
1781 str = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1782 if (!str)
1783 {
1785 return 0;
1786 }
1787
1789 if (result != len - 1)
1790 {
1792 return 0;
1793 }
1794
1795 len = file_name_WtoA( str, -1, NULL, 0 );
1796 if (count < len)
1797 {
1799 return len - 1;
1800 }
1801 file_name_WtoA( str, -1, path, count );
1803 return len - 1;
1804}
1805
1806
1807/***********************************************************************
1808 * GetFinalPathNameByHandleW (kernelbase.@)
1809 */
1812{
1815 WCHAR drive_part[MAX_PATH];
1816 DWORD drive_part_len = 0;
1818 DWORD result = 0;
1819 ULONG dummy;
1820 WCHAR *ptr;
1821
1822 TRACE( "(%p,%p,%ld,%lx)\n", file, path, count, flags );
1823
1825 {
1826 WARN("Unknown flags: %lx\n", flags);
1828 return 0;
1829 }
1830
1831 /* get object name */
1833 if (!set_ntstatus( status )) return 0;
1834
1835 if (!info->Name.Buffer)
1836 {
1838 return 0;
1839 }
1840 if (info->Name.Length < 4 * sizeof(WCHAR) || info->Name.Buffer[0] != '\\' ||
1841 info->Name.Buffer[1] != '?' || info->Name.Buffer[2] != '?' || info->Name.Buffer[3] != '\\' )
1842 {
1843 FIXME("Unexpected object name: %s\n", debugstr_wn(info->Name.Buffer, info->Name.Length / sizeof(WCHAR)));
1845 return 0;
1846 }
1847
1848 /* add terminating null character, remove "\\??\\" */
1849 info->Name.Buffer[info->Name.Length / sizeof(WCHAR)] = 0;
1850 info->Name.Length -= 4 * sizeof(WCHAR);
1851 info->Name.Buffer += 4;
1852
1853 /* FILE_NAME_OPENED is not supported yet, and would require Wineserver changes */
1854 if (flags & FILE_NAME_OPENED)
1855 {
1856 FIXME("FILE_NAME_OPENED not supported\n");
1857 flags &= ~FILE_NAME_OPENED;
1858 }
1859
1860 /* Get information required for VOLUME_NAME_NONE, VOLUME_NAME_GUID and VOLUME_NAME_NT */
1862 {
1863 if (!GetVolumePathNameW( info->Name.Buffer, drive_part, MAX_PATH )) return 0;
1864 drive_part_len = lstrlenW(drive_part);
1865 if (!drive_part_len || drive_part_len > lstrlenW(info->Name.Buffer) ||
1866 drive_part[drive_part_len-1] != '\\' ||
1867 CompareStringOrdinal( info->Name.Buffer, drive_part_len, drive_part, drive_part_len, TRUE ) != CSTR_EQUAL)
1868 {
1869 FIXME( "Path %s returned by GetVolumePathNameW does not match file path %s\n",
1870 debugstr_w(drive_part), debugstr_w(info->Name.Buffer) );
1872 return 0;
1873 }
1874 }
1875
1876 if (flags == VOLUME_NAME_NONE)
1877 {
1878 ptr = info->Name.Buffer + drive_part_len - 1;
1879 result = lstrlenW(ptr);
1880 if (result < count) memcpy(path, ptr, (result + 1) * sizeof(WCHAR));
1881 else result++;
1882 }
1883 else if (flags == VOLUME_NAME_GUID)
1884 {
1885 WCHAR volume_prefix[51];
1886
1887 /* GetVolumeNameForVolumeMountPointW sets error code on failure */
1888 if (!GetVolumeNameForVolumeMountPointW( drive_part, volume_prefix, 50 )) return 0;
1889 ptr = info->Name.Buffer + drive_part_len;
1890 result = lstrlenW(volume_prefix) + lstrlenW(ptr);
1891 if (result < count)
1892 {
1893 lstrcpyW(path, volume_prefix);
1894 lstrcatW(path, ptr);
1895 }
1896 else
1897 {
1899 result++;
1900 }
1901 }
1902 else if (flags == VOLUME_NAME_NT)
1903 {
1904 WCHAR nt_prefix[MAX_PATH];
1905
1906 /* QueryDosDeviceW sets error code on failure */
1907 drive_part[drive_part_len - 1] = 0;
1908 if (!QueryDosDeviceW( drive_part, nt_prefix, MAX_PATH )) return 0;
1909 ptr = info->Name.Buffer + drive_part_len - 1;
1910 result = lstrlenW(nt_prefix) + lstrlenW(ptr);
1911 if (result < count)
1912 {
1913 lstrcpyW(path, nt_prefix);
1914 lstrcatW(path, ptr);
1915 }
1916 else
1917 {
1919 result++;
1920 }
1921 }
1922 else if (flags == VOLUME_NAME_DOS)
1923 {
1924 result = 4 + lstrlenW(info->Name.Buffer);
1925 if (result < count)
1926 {
1927 lstrcpyW(path, L"\\\\?\\");
1928 lstrcatW(path, info->Name.Buffer);
1929 }
1930 else
1931 {
1933 result++;
1934 }
1935 }
1936 else
1937 {
1938 /* Windows crashes here, but we prefer returning ERROR_INVALID_PARAMETER */
1939 WARN("Invalid combination of flags: %lx\n", flags);
1941 }
1942 return result;
1943}
1944
1945
1946/***********************************************************************
1947 * GetFullPathNameA (kernelbase.@)
1948 */
1950{
1951 WCHAR *nameW;
1952 WCHAR bufferW[MAX_PATH], *lastpartW = NULL;
1953 DWORD ret;
1954
1955 if (!(nameW = file_name_AtoW( name, FALSE ))) return 0;
1956
1957 ret = GetFullPathNameW( nameW, MAX_PATH, bufferW, &lastpartW );
1958
1959 if (!ret) return 0;
1960 if (ret > MAX_PATH)
1961 {
1963 return 0;
1964 }
1965 ret = copy_filename_WtoA( bufferW, buffer, len );
1966 if (ret < len && lastpart)
1967 {
1968 if (lastpartW)
1969 *lastpart = buffer + file_name_WtoA( bufferW, lastpartW - bufferW, NULL, 0 );
1970 else
1971 *lastpart = NULL;
1972 }
1973 return ret;
1974}
1975
1976
1977/***********************************************************************
1978 * GetFullPathNameW (kernelbase.@)
1979 */
1981{
1982 return RtlGetFullPathName_U( name, len * sizeof(WCHAR), buffer, lastpart ) / sizeof(WCHAR);
1983}
1984
1985
1986/***********************************************************************
1987 * GetLongPathNameA (kernelbase.@)
1988 */
1990{
1991 WCHAR *shortpathW;
1992 WCHAR longpathW[MAX_PATH];
1993 DWORD ret;
1994
1995 TRACE( "%s\n", debugstr_a( shortpath ));
1996
1997 if (!(shortpathW = file_name_AtoW( shortpath, FALSE ))) return 0;
1998
1999 ret = GetLongPathNameW( shortpathW, longpathW, MAX_PATH );
2000
2001 if (!ret) return 0;
2002 if (ret > MAX_PATH)
2003 {
2005 return 0;
2006 }
2007 return copy_filename_WtoA( longpathW, longpath, longlen );
2008}
2009
2010
2011/***********************************************************************
2012 * GetLongPathNameW (kernelbase.@)
2013 */
2015{
2016 WCHAR tmplongpath[1024];
2017 DWORD sp = 0, lp = 0, tmplen;
2018 WIN32_FIND_DATAW wfd;
2020 LPCWSTR p;
2021 HANDLE handle;
2022
2023 TRACE("%s,%p,%lu\n", debugstr_w(shortpath), longpath, longlen);
2024
2025 if (!shortpath)
2026 {
2028 return 0;
2029 }
2030 if (!shortpath[0])
2031 {
2033 return 0;
2034 }
2035
2036 if (shortpath[0] == '\\' && shortpath[1] == '\\')
2037 {
2038 FIXME( "UNC pathname %s\n", debugstr_w(shortpath) );
2039 tmplen = lstrlenW( shortpath );
2040 if (tmplen < longlen)
2041 {
2042 if (longpath != shortpath) lstrcpyW( longpath, shortpath );
2043 return tmplen;
2044 }
2045 return tmplen + 1;
2046 }
2047
2048 /* check for drive letter */
2049 if (shortpath[0] != '/' && shortpath[1] == ':' )
2050 {
2051 tmplongpath[0] = shortpath[0];
2052 tmplongpath[1] = ':';
2053 lp = sp = 2;
2054 }
2055
2056 if (wcspbrk( shortpath + sp, L"*?" ))
2057 {
2059 return 0;
2060 }
2061
2062 while (shortpath[sp])
2063 {
2064 /* check for path delimiters and reproduce them */
2065 if (shortpath[sp] == '\\' || shortpath[sp] == '/')
2066 {
2067 tmplongpath[lp++] = shortpath[sp++];
2068 tmplongpath[lp] = 0; /* terminate string */
2069 continue;
2070 }
2071
2072 for (p = shortpath + sp; *p && *p != '/' && *p != '\\'; p++);
2073 tmplen = p - (shortpath + sp);
2074 lstrcpynW( tmplongpath + lp, shortpath + sp, tmplen + 1 );
2075
2076 if (tmplongpath[lp] == '.')
2077 {
2078 if (tmplen == 1 || (tmplen == 2 && tmplongpath[lp + 1] == '.'))
2079 {
2080 lp += tmplen;
2081 sp += tmplen;
2082 continue;
2083 }
2084 }
2085
2086 /* Check if the file exists */
2087 handle = FindFirstFileW( tmplongpath, &wfd );
2089 {
2090 TRACE( "not found %s\n", debugstr_w( tmplongpath ));
2092 return 0;
2093 }
2094 FindClose( handle );
2095
2096 /* Use the existing file name if it's a short name */
2097 RtlInitUnicodeString( &nameW, tmplongpath + lp );
2098 if (RtlIsNameLegalDOS8Dot3( &nameW, NULL, NULL )) lstrcpyW( tmplongpath + lp, wfd.cFileName );
2099 lp += lstrlenW( tmplongpath + lp );
2100 sp += tmplen;
2101 }
2102 tmplen = lstrlenW( shortpath ) - 1;
2103 if ((shortpath[tmplen] == '/' || shortpath[tmplen] == '\\') &&
2104 (tmplongpath[lp - 1] != '/' && tmplongpath[lp - 1] != '\\'))
2105 tmplongpath[lp++] = shortpath[tmplen];
2106 tmplongpath[lp] = 0;
2107
2108 tmplen = lstrlenW( tmplongpath ) + 1;
2109 if (tmplen <= longlen)
2110 {
2111 lstrcpyW( longpath, tmplongpath );
2112 TRACE("returning %s\n", debugstr_w( longpath ));
2113 tmplen--; /* length without 0 */
2114 }
2115 return tmplen;
2116}
2117
2118
2119/***********************************************************************
2120 * GetShortPathNameW (kernelbase.@)
2121 */
2123{
2124 WIN32_FIND_DATAW wfd;
2125 WCHAR *tmpshortpath;
2126 HANDLE handle;
2127 LPCWSTR p;
2128 DWORD sp = 0, lp = 0, tmplen, buf_len;
2129
2130 TRACE( "%s,%p,%lu\n", debugstr_w(longpath), shortpath, shortlen );
2131
2132 if (!longpath)
2133 {
2135 return 0;
2136 }
2137 if (!longpath[0])
2138 {
2140 return 0;
2141 }
2142
2143 /* code below only removes characters from string, never adds, so this is
2144 * the largest buffer that tmpshortpath will need to have */
2145 buf_len = lstrlenW(longpath) + 1;
2146 tmpshortpath = HeapAlloc( GetProcessHeap(), 0, buf_len * sizeof(WCHAR) );
2147 if (!tmpshortpath)
2148 {
2150 return 0;
2151 }
2152
2153 if (longpath[0] == '\\' && longpath[1] == '\\' && longpath[2] == '?' && longpath[3] == '\\')
2154 {
2155 memcpy( tmpshortpath, longpath, 4 * sizeof(WCHAR) );
2156 sp = lp = 4;
2157 }
2158
2159 if (wcspbrk( longpath + lp, L"*?" ))
2160 {
2161 HeapFree( GetProcessHeap(), 0, tmpshortpath );
2163 return 0;
2164 }
2165
2166 /* check for drive letter */
2167 if (longpath[lp] != '/' && longpath[lp + 1] == ':' )
2168 {
2169 tmpshortpath[sp] = longpath[lp];
2170 tmpshortpath[sp + 1] = ':';
2171 sp += 2;
2172 lp += 2;
2173 }
2174
2175 while (longpath[lp])
2176 {
2177 /* check for path delimiters and reproduce them */
2178 if (longpath[lp] == '\\' || longpath[lp] == '/')
2179 {
2180 tmpshortpath[sp++] = longpath[lp++];
2181 tmpshortpath[sp] = 0; /* terminate string */
2182 continue;
2183 }
2184
2185 p = longpath + lp;
2186 for (; *p && *p != '/' && *p != '\\'; p++);
2187 tmplen = p - (longpath + lp);
2188 lstrcpynW( tmpshortpath + sp, longpath + lp, tmplen + 1 );
2189
2190 if (tmpshortpath[sp] == '.')
2191 {
2192 if (tmplen == 1 || (tmplen == 2 && tmpshortpath[sp + 1] == '.'))
2193 {
2194 sp += tmplen;
2195 lp += tmplen;
2196 continue;
2197 }
2198 }
2199
2200 /* Check if the file exists and use the existing short file name */
2201 handle = FindFirstFileW( tmpshortpath, &wfd );
2202 if (handle == INVALID_HANDLE_VALUE) goto notfound;
2203 FindClose( handle );
2204
2205 /* In rare cases (like "a.abcd") short path may be longer than original path.
2206 * Make sure we have enough space in temp buffer. */
2207 if (wfd.cAlternateFileName[0] && tmplen < lstrlenW(wfd.cAlternateFileName))
2208 {
2209 WCHAR *new_buf;
2210 buf_len += lstrlenW( wfd.cAlternateFileName ) - tmplen;
2211 new_buf = HeapReAlloc( GetProcessHeap(), 0, tmpshortpath, buf_len * sizeof(WCHAR) );
2212 if(!new_buf)
2213 {
2214 HeapFree( GetProcessHeap(), 0, tmpshortpath );
2216 return 0;
2217 }
2218 tmpshortpath = new_buf;
2219 }
2220
2221 lstrcpyW( tmpshortpath + sp, wfd.cAlternateFileName[0] ? wfd.cAlternateFileName : wfd.cFileName );
2222 sp += lstrlenW( tmpshortpath + sp );
2223 lp += tmplen;
2224 }
2225 tmpshortpath[sp] = 0;
2226
2227 tmplen = lstrlenW( tmpshortpath ) + 1;
2228 if (tmplen <= shortlen)
2229 {
2230 lstrcpyW( shortpath, tmpshortpath );
2231 TRACE( "returning %s\n", debugstr_w( shortpath ));
2232 tmplen--; /* length without 0 */
2233 }
2234
2235 HeapFree( GetProcessHeap(), 0, tmpshortpath );
2236 return tmplen;
2237
2238 notfound:
2239 HeapFree( GetProcessHeap(), 0, tmpshortpath );
2240 TRACE( "not found\n" );
2242 return 0;
2243}
2244
2245
2246/***********************************************************************
2247 * GetSystemDirectoryA (kernelbase.@)
2248 */
2250{
2252}
2253
2254
2255/***********************************************************************
2256 * GetSystemDirectoryW (kernelbase.@)
2257 */
2259{
2260 return copy_filename( system_dir, path, count );
2261}
2262
2263
2264/***********************************************************************
2265 * GetSystemWindowsDirectoryA (kernelbase.@)
2266 */
2268{
2269 return GetWindowsDirectoryA( path, count );
2270}
2271
2272
2273/***********************************************************************
2274 * GetSystemWindowsDirectoryW (kernelbase.@)
2275 */
2277{
2278 return GetWindowsDirectoryW( path, count );
2279}
2280
2281
2282/***********************************************************************
2283 * GetSystemWow64DirectoryA (kernelbase.@)
2284 */
2286{
2287 if (!is_win64 && !is_wow64)
2288 {
2290 return 0;
2291 }
2293}
2294
2295
2296/***********************************************************************
2297 * GetSystemWow64DirectoryW (kernelbase.@)
2298 */
2300{
2301 if (!is_win64 && !is_wow64)
2302 {
2304 return 0;
2305 }
2307}
2308
2309
2310/***********************************************************************
2311 * GetSystemWow64Directory2A (kernelbase.@)
2312 */
2314{
2316
2317 return dir ? copy_filename_WtoA( dir, path, count ) : 0;
2318}
2319
2320
2321/***********************************************************************
2322 * GetSystemWow64Directory2W (kernelbase.@)
2323 */
2325{
2327
2328 return dir ? copy_filename( dir, path, count ) : 0;
2329}
2330
2331
2332/***********************************************************************
2333 * GetTempFileNameA (kernelbase.@)
2334 */
2336{
2337 WCHAR *pathW, *prefixW = NULL;
2338 WCHAR bufferW[MAX_PATH];
2339 UINT ret;
2340
2341 if (!(pathW = file_name_AtoW( path, FALSE ))) return 0;
2342 if (prefix && !(prefixW = file_name_AtoW( prefix, TRUE ))) return 0;
2343
2344 ret = GetTempFileNameW( pathW, prefixW, unique, bufferW );
2345 if (ret) file_name_WtoA( bufferW, -1, buffer, MAX_PATH );
2346
2347 HeapFree( GetProcessHeap(), 0, prefixW );
2348 return ret;
2349}
2350
2351
2352/***********************************************************************
2353 * GetTempFileNameW (kernelbase.@)
2354 */
2356{
2357 int i;
2358 LPWSTR p;
2359 DWORD attr;
2360
2361 if (!path || !buffer)
2362 {
2364 return 0;
2365 }
2366
2367 /* ensure that the provided directory exists */
2370 {
2371 TRACE( "path not found %s\n", debugstr_w( path ));
2373 return 0;
2374 }
2375
2376 lstrcpyW( buffer, path );
2377 p = buffer + lstrlenW(buffer);
2378
2379 /* add a \, if there isn't one */
2380 if ((p == buffer) || (p[-1] != '\\')) *p++ = '\\';
2381
2382 if (prefix) for (i = 3; (i > 0) && (*prefix); i--) *p++ = *prefix++;
2383
2384 unique &= 0xffff;
2385 if (unique) swprintf( p, MAX_PATH - (p - buffer), L"%x.tmp", unique );
2386 else
2387 {
2388 /* get a "random" unique number and try to create the file */
2389 HANDLE handle;
2390 UINT num = NtGetTickCount() & 0xffff;
2391 static UINT last;
2392
2393 /* avoid using the same name twice in a short interval */
2394 if (last - num < 10) num = last + 1;
2395 if (!num) num = 1;
2396 unique = num;
2397 do
2398 {
2399 swprintf( p, MAX_PATH - (p - buffer), L"%x.tmp", unique );
2402 { /* We created it */
2404 last = unique;
2405 break;
2406 }
2408 break; /* No need to go on */
2409 if (!(++unique & 0xffff)) unique = 1;
2410 } while (unique != num);
2411 }
2412 TRACE( "returning %s\n", debugstr_w( buffer ));
2413 return unique;
2414}
2415
2416
2417/***********************************************************************
2418 * GetTempPathA (kernelbase.@)
2419 */
2421{
2422 WCHAR pathW[MAX_PATH];
2423 UINT ret;
2424
2425 if (!(ret = GetTempPathW( MAX_PATH, pathW ))) return 0;
2426 if (ret > MAX_PATH)
2427 {
2429 return 0;
2430 }
2431 return copy_filename_WtoA( pathW, path, count );
2432}
2433
2434
2435/***********************************************************************
2436 * GetTempPathW (kernelbase.@)
2437 */
2439{
2440 WCHAR tmp_path[MAX_PATH];
2441 UINT ret;
2442
2443 if (!(ret = GetEnvironmentVariableW( L"TMP", tmp_path, MAX_PATH )) &&
2444 !(ret = GetEnvironmentVariableW( L"TEMP", tmp_path, MAX_PATH )) &&
2445 !(ret = GetEnvironmentVariableW( L"USERPROFILE", tmp_path, MAX_PATH )) &&
2446 !(ret = GetWindowsDirectoryW( tmp_path, MAX_PATH )))
2447 return 0;
2448
2449 if (ret > MAX_PATH)
2450 {
2452 return 0;
2453 }
2454 ret = GetFullPathNameW( tmp_path, MAX_PATH, tmp_path, NULL );
2455 if (!ret) return 0;
2456
2457 if (ret > MAX_PATH - 2)
2458 {
2460 return 0;
2461 }
2462 if (tmp_path[ret-1] != '\\')
2463 {
2464 tmp_path[ret++] = '\\';
2465 tmp_path[ret] = '\0';
2466 }
2467
2468 ret++; /* add space for terminating 0 */
2469 if (count >= ret)
2470 {
2471 lstrcpynW( path, tmp_path, count );
2472 /* the remaining buffer must be zeroed up to 32766 bytes in XP or 32767
2473 * bytes after it, we will assume the > XP behavior for now */
2474 memset( path + ret, 0, (min(count, 32767) - ret) * sizeof(WCHAR) );
2475 ret--; /* return length without 0 */
2476 }
2477 else if (count)
2478 {
2479 /* the buffer must be cleared if contents will not fit */
2480 memset( path, 0, count * sizeof(WCHAR) );
2481 }
2482
2483 TRACE( "returning %u, %s\n", ret, debugstr_w( path ));
2484 return ret;
2485}
2486
2487
2488/***********************************************************************
2489 * GetTempPath2A (kernelbase.@)
2490 */
2492{
2493 /* TODO: Set temp path to C:\Windows\SystemTemp\ when a SYSTEM process calls this function */
2494 FIXME("(%lu, %p) semi-stub\n", count, path);
2495 return GetTempPathA(count, path);
2496}
2497
2498
2499/***********************************************************************
2500 * GetTempPath2W (kernelbase.@)
2501 */
2503{
2504 /* TODO: Set temp path to C:\Windows\SystemTemp\ when a SYSTEM process calls this function */
2505 FIXME("(%lu, %p) semi-stub\n", count, path);
2506 return GetTempPathW(count, path);
2507}
2508
2509
2510/***********************************************************************
2511 * GetWindowsDirectoryA (kernelbase.@)
2512 */
2514{
2516}
2517
2518
2519/***********************************************************************
2520 * GetWindowsDirectoryW (kernelbase.@)
2521 */
2523{
2524 return copy_filename( windows_dir, path, count );
2525}
2526
2527
2528/**************************************************************************
2529 * MoveFileExW (kernelbase.@)
2530 */
2532{
2534}
2535
2536
2537/**************************************************************************
2538 * MoveFileWithProgressW (kernelbase.@)
2539 */
2542 void *param, DWORD flag )
2543{
2544 FILE_RENAME_INFORMATION *rename_info;
2546 UNICODE_STRING nt_name;
2550 HANDLE source_handle = 0;
2551 ULONG size;
2552
2553 TRACE( "(%s,%s,%p,%p,%04lx)\n", debugstr_w(source), debugstr_w(dest), progress, param, flag );
2554
2556
2557 if (!dest) return DeleteFileW( source );
2558
2559 /* check if we are allowed to rename the source */
2560
2561 if (!RtlDosPathNameToNtPathName_U( source, &nt_name, NULL, NULL ))
2562 {
2564 return FALSE;
2565 }
2566 attr.Length = sizeof(attr);
2567 attr.RootDirectory = 0;
2568 attr.Attributes = OBJ_CASE_INSENSITIVE;
2569 attr.ObjectName = &nt_name;
2570 attr.SecurityDescriptor = NULL;
2571 attr.SecurityQualityOfService = NULL;
2572
2573 status = NtOpenFile( &source_handle, DELETE | SYNCHRONIZE, &attr, &io,
2576 RtlFreeUnicodeString( &nt_name );
2577 if (!set_ntstatus( status )) goto error;
2578
2579 status = NtQueryInformationFile( source_handle, &io, &info, sizeof(info), FileBasicInformation );
2580 if (!set_ntstatus( status )) goto error;
2581
2582 if (!RtlDosPathNameToNtPathName_U( dest, &nt_name, NULL, NULL ))
2583 {
2585 goto error;
2586 }
2587
2589 if (!(rename_info = HeapAlloc( GetProcessHeap(), 0, size ))) goto error;
2590
2591 rename_info->ReplaceIfExists = !!(flag & MOVEFILE_REPLACE_EXISTING);
2592 rename_info->RootDirectory = NULL;
2593 rename_info->FileNameLength = nt_name.Length;
2594 memcpy( rename_info->FileName, nt_name.Buffer, nt_name.Length );
2595 RtlFreeUnicodeString( &nt_name );
2596 status = NtSetInformationFile( source_handle, &io, rename_info, size, FileRenameInformation );
2597 HeapFree( GetProcessHeap(), 0, rename_info );
2599 {
2600 NtClose( source_handle );
2603 return FALSE;
2604 return DeleteFileW( source );
2605 }
2606
2607 NtClose( source_handle );
2608 return set_ntstatus( status );
2609
2610error:
2611 if (source_handle) NtClose( source_handle );
2612 return FALSE;
2613}
2614
2615
2616/***********************************************************************
2617 * NeedCurrentDirectoryForExePathA (kernelbase.@)
2618 */
2620{
2621 WCHAR *nameW;
2622
2623 if (!(nameW = file_name_AtoW( name, FALSE ))) return TRUE;
2625}
2626
2627
2628/***********************************************************************
2629 * NeedCurrentDirectoryForExePathW (kernelbase.@)
2630 */
2632{
2633 WCHAR env_val;
2634
2635 if (wcschr( name, '\\' )) return TRUE;
2636 /* check the existence of the variable, not value */
2637 return !GetEnvironmentVariableW( L"NoDefaultCurrentDirectoryInExePath", &env_val, 1 );
2638}
2639
2640
2641/***********************************************************************
2642 * ReplaceFileW (kernelbase.@)
2643 */
2644BOOL WINAPI DECLSPEC_HOTPATCH ReplaceFileW( const WCHAR *replaced, const WCHAR *replacement,
2645 const WCHAR *backup, DWORD flags,
2646 void *exclude, void *reserved )
2647{
2648 UNICODE_STRING nt_replaced_name, nt_replacement_name;
2649 HANDLE hReplacement = NULL;
2654
2655 TRACE( "%s %s %s 0x%08lx %p %p\n", debugstr_w(replaced), debugstr_w(replacement), debugstr_w(backup),
2656 flags, exclude, reserved );
2657
2658 if (flags) FIXME("Ignoring flags %lx\n", flags);
2659
2660 /* First two arguments are mandatory */
2661 if (!replaced || !replacement)
2662 {
2664 return FALSE;
2665 }
2666
2667 attr.Length = sizeof(attr);
2668 attr.RootDirectory = 0;
2669 attr.Attributes = OBJ_CASE_INSENSITIVE;
2670 attr.ObjectName = NULL;
2671 attr.SecurityDescriptor = NULL;
2672 attr.SecurityQualityOfService = NULL;
2673
2674 /* Open the "replaced" file for reading */
2675 if (!RtlDosPathNameToNtPathName_U( replaced, &nt_replaced_name, NULL, NULL ))
2676 {
2678 return FALSE;
2679 }
2680 attr.ObjectName = &nt_replaced_name;
2681
2682 /* Replacement should fail if replaced is READ_ONLY */
2684 RtlFreeUnicodeString(&nt_replaced_name);
2685 if (!set_ntstatus( status )) return FALSE;
2686
2687 if (info.FileAttributes & FILE_ATTRIBUTE_READONLY)
2688 {
2690 return FALSE;
2691 }
2692
2693 /*
2694 * Open the replacement file for reading, writing, and deleting
2695 * (writing and deleting are needed when finished)
2696 */
2697 if (!RtlDosPathNameToNtPathName_U( replacement, &nt_replacement_name, NULL, NULL ))
2698 {
2700 return FALSE;
2701 }
2702 attr.ObjectName = &nt_replacement_name;
2705 RtlFreeUnicodeString(&nt_replacement_name);
2706 if (!set_ntstatus( status )) return FALSE;
2707 NtClose( hReplacement );
2708
2709 /* If the user wants a backup then that needs to be performed first */
2710 if (backup)
2711 {
2712 if (!MoveFileExW( replaced, backup, MOVEFILE_REPLACE_EXISTING )) return FALSE;
2713 }
2714 else
2715 {
2716 /* ReplaceFile() can replace an open target. To do this, we need to move
2717 * it out of the way first. */
2719
2720 lstrcpynW( temp_path, replaced, ARRAY_SIZE( temp_path ) );
2722 if (!GetTempFileNameW( temp_path, L"rf", 0, temp_file ) ||
2724 return FALSE;
2725
2727 }
2728
2729 /*
2730 * Now that the backup has been performed (if requested), copy the replacement
2731 * into place
2732 */
2733 if (!MoveFileExW( replacement, replaced, 0 ))
2734 {
2735 /* on failure we need to indicate whether a backup was made */
2736 if (!backup)
2738 else
2740 return FALSE;
2741 }
2742 return TRUE;
2743}
2744
2745
2746/***********************************************************************
2747 * SearchPathA (kernelbase.@)
2748 */
2750 DWORD buflen, LPSTR buffer, LPSTR *lastpart )
2751{
2752 WCHAR *pathW = NULL, *nameW, *extW = NULL;
2753 WCHAR bufferW[MAX_PATH];
2754 DWORD ret;
2755
2756 if (!name)
2757 {
2759 return 0;
2760 }
2761
2762 if (!(nameW = file_name_AtoW( name, FALSE ))) return 0;
2763 if (path && !(pathW = file_name_AtoW( path, TRUE ))) return 0;
2764 if (ext && !(extW = file_name_AtoW( ext, TRUE )))
2765 {
2766 RtlFreeHeap( GetProcessHeap(), 0, pathW );
2767 return 0;
2768 }
2769
2770 ret = SearchPathW( pathW, nameW, extW, MAX_PATH, bufferW, NULL );
2771
2772 RtlFreeHeap( GetProcessHeap(), 0, pathW );
2773 RtlFreeHeap( GetProcessHeap(), 0, extW );
2774
2775 if (!ret) return 0;
2776 if (ret > MAX_PATH)
2777 {
2779 return 0;
2780 }
2781 ret = copy_filename_WtoA( bufferW, buffer, buflen );
2782 if (buflen > ret && lastpart) *lastpart = strrchr(buffer, '\\') + 1;
2783 return ret;
2784}
2785
2786
2787/***********************************************************************
2788 * SearchPathW (kernelbase.@)
2789 */
2791 LPWSTR buffer, LPWSTR *lastpart )
2792{
2793 DWORD ret = 0;
2794 WCHAR *name_ext;
2795
2796 if (!name || !name[0])
2797 {
2799 return 0;
2800 }
2801
2802 /* If the name contains an explicit path, ignore the path */
2803
2804 if (contains_path( name ))
2805 {
2806 /* try first without extension */
2807 if (RtlDoesFileExists_U( name )) return GetFullPathNameW( name, buflen, buffer, lastpart );
2808
2809 if ((name_ext = append_ext( name, ext )))
2810 {
2811 if (RtlDoesFileExists_U( name_ext ))
2812 ret = GetFullPathNameW( name_ext, buflen, buffer, lastpart );
2813 RtlFreeHeap( GetProcessHeap(), 0, name_ext );
2814 }
2815 }
2816 else if (path && path[0]) /* search in the specified path */
2817 {
2818 ret = RtlDosSearchPath_U( path, name, ext, buflen * sizeof(WCHAR),
2819 buffer, lastpart ) / sizeof(WCHAR);
2820 }
2821 else /* search in active context and default path */
2822 {
2823 WCHAR *dll_path = NULL, *name_ext = append_ext( name, ext );
2824
2825 if (name_ext) name = name_ext;
2826
2827 /* When file is found with activation context no attempt is made
2828 to check if it's really exist, path is returned only basing on context info. */
2829 if (find_actctx_dllpath( name, &dll_path ) == STATUS_SUCCESS)
2830 {
2831 ret = lstrlenW( dll_path ) + lstrlenW( name ) + 1;
2832
2833 /* count null termination char too */
2834 if (ret <= buflen)
2835 {
2836 lstrcpyW( buffer, dll_path );
2837 lstrcatW( buffer, name );
2838 if (lastpart) *lastpart = buffer + lstrlenW( dll_path );
2839 ret--;
2840 }
2841 else if (lastpart) *lastpart = NULL;
2842 RtlFreeHeap( GetProcessHeap(), 0, dll_path );
2843 }
2844 else if (!RtlGetSearchPath( &dll_path ))
2845 {
2846 ret = RtlDosSearchPath_U( dll_path, name, NULL, buflen * sizeof(WCHAR),
2847 buffer, lastpart ) / sizeof(WCHAR);
2848 RtlReleasePath( dll_path );
2849 }
2850 RtlFreeHeap( GetProcessHeap(), 0, name_ext );
2851 }
2852
2854 else TRACE( "found %s\n", debugstr_w(buffer) );
2855 return ret;
2856}
2857
2858
2859/***********************************************************************
2860 * SetCurrentDirectoryA (kernelbase.@)
2861 */
2863{
2864 WCHAR *dirW;
2866
2867 if (!(dirW = file_name_AtoW( dir, FALSE ))) return FALSE;
2868 RtlInitUnicodeString( &strW, dirW );
2870}
2871
2872
2873/***********************************************************************
2874 * SetCurrentDirectoryW (kernelbase.@)
2875 */
2877{
2878 UNICODE_STRING dirW;
2879
2880 RtlInitUnicodeString( &dirW, dir );
2881 return set_ntstatus( RtlSetCurrentDirectory_U( &dirW ));
2882}
2883
2884
2885/**************************************************************************
2886 * SetFileApisToANSI (kernelbase.@)
2887 */
2889{
2891}
2892
2893
2894/**************************************************************************
2895 * SetFileApisToOEM (kernelbase.@)
2896 */
2898{
2900}
2901
2902
2903/**************************************************************************
2904 * SetFileAttributesA (kernelbase.@)
2905 */
2907{
2908 WCHAR *nameW;
2909
2910 if (!(nameW = file_name_AtoW( name, FALSE ))) return FALSE;
2911 return SetFileAttributesW( nameW, attributes );
2912}
2913
2914
2915/**************************************************************************
2916 * SetFileAttributesW (kernelbase.@)
2917 */
2919{
2920 UNICODE_STRING nt_name;
2924 HANDLE handle;
2925
2926 TRACE( "%s %lx\n", debugstr_w(name), attributes );
2927
2928 if (!RtlDosPathNameToNtPathName_U( name, &nt_name, NULL, NULL ))
2929 {
2931 return FALSE;
2932 }
2933
2934 attr.Length = sizeof(attr);
2935 attr.RootDirectory = 0;
2936 attr.Attributes = OBJ_CASE_INSENSITIVE;
2937 attr.ObjectName = &nt_name;
2938 attr.SecurityDescriptor = NULL;
2939 attr.SecurityQualityOfService = NULL;
2940
2942 RtlFreeUnicodeString( &nt_name );
2943
2944 if (status == STATUS_SUCCESS)
2945 {
2947
2948 memset( &info, 0, sizeof(info) );
2949 info.FileAttributes = attributes | FILE_ATTRIBUTE_NORMAL; /* make sure it's not zero */
2951 NtClose( handle );
2952 }
2953 return set_ntstatus( status );
2954}
2955
2956
2957/***********************************************************************
2958 * Wow64DisableWow64FsRedirection (kernelbase.@)
2959 */
2961{
2963}
2964
2965
2966/***********************************************************************
2967 * Wow64EnableWow64FsRedirection (kernelbase.@)
2968 *
2969 * Microsoft C++ Redistributable installers are depending on all %eax bits being set.
2970 */
2972{
2974}
2975
2976
2977/***********************************************************************
2978 * Wow64RevertWow64FsRedirection (kernelbase.@)
2979 */
2981{
2983}
2984
2985
2986/***********************************************************************
2987 * Operations on file handles
2988 ***********************************************************************/
2989
2990
2991/***********************************************************************
2992 * CancelIo (kernelbase.@)
2993 */
2995{
2997
2998 return set_ntstatus( NtCancelIoFile( handle, &io ) );
2999}
3000
3001
3002/***********************************************************************
3003 * CancelIoEx (kernelbase.@)
3004 */
3006{
3008
3010}
3011
3012
3013/***********************************************************************
3014 * CancelSynchronousIo (kernelbase.@)
3015 */
3017{
3019
3020 return set_ntstatus( NtCancelSynchronousIoFile( thread, NULL, &io ));
3021}
3022
3023
3024/***********************************************************************
3025 * FlushFileBuffers (kernelbase.@)
3026 */
3028{
3030
3032}
3033
3034
3035/***********************************************************************
3036 * GetFileInformationByHandle (kernelbase.@)
3037 */
3039{
3041 FILE_STAT_INFORMATION stat_info;
3044
3045 status = NtQueryInformationFile( file, &io, &stat_info, sizeof(stat_info), FileStatInformation );
3046 if (!set_ntstatus( status )) return FALSE;
3047
3048 info->dwFileAttributes = stat_info.FileAttributes;
3049 info->ftCreationTime.dwHighDateTime = stat_info.CreationTime.u.HighPart;
3050 info->ftCreationTime.dwLowDateTime = stat_info.CreationTime.u.LowPart;
3051 info->ftLastAccessTime.dwHighDateTime = stat_info.LastAccessTime.u.HighPart;
3052 info->ftLastAccessTime.dwLowDateTime = stat_info.LastAccessTime.u.LowPart;
3053 info->ftLastWriteTime.dwHighDateTime = stat_info.LastWriteTime.u.HighPart;
3054 info->ftLastWriteTime.dwLowDateTime = stat_info.LastWriteTime.u.LowPart;
3055 info->dwVolumeSerialNumber = 0;
3056 info->nFileSizeHigh = stat_info.EndOfFile.u.HighPart;
3057 info->nFileSizeLow = stat_info.EndOfFile.u.LowPart;
3058 info->nNumberOfLinks = stat_info.NumberOfLinks;
3059 info->nFileIndexHigh = stat_info.FileId.u.HighPart;
3060 info->nFileIndexLow = stat_info.FileId.u.LowPart;
3061
3064 info->dwVolumeSerialNumber = volume_info.VolumeSerialNumber;
3065
3066 return TRUE;
3067}
3068
3069
3070/***********************************************************************
3071 * GetFileInformationByHandleEx (kernelbase.@)
3072 */
3075{
3078
3079 switch (class)
3080 {
3081 case FileRemoteProtocolInfo:
3082 case FileStorageInfo:
3083 case FileDispositionInfoEx:
3084 case FileRenameInfoEx:
3085 case FileCaseSensitiveInfo:
3086 case FileNormalizedNameInfo:
3087 FIXME( "%p, %u, %p, %lu\n", handle, class, info, size );
3089 return FALSE;
3090
3091 case FileStreamInfo:
3093 break;
3094
3095 case FileCompressionInfo:
3097 break;
3098
3099 case FileAlignmentInfo:
3101 break;
3102
3103 case FileAttributeTagInfo:
3105 break;
3106
3107 case FileBasicInfo:
3109 break;
3110
3111 case FileStandardInfo:
3113 break;
3114
3115 case FileNameInfo:
3117 break;
3118
3119 case FileIdInfo:
3121 break;
3122
3123 case FileIdBothDirectoryRestartInfo:
3124 case FileIdBothDirectoryInfo:
3127 (class == FileIdBothDirectoryRestartInfo) );
3128 break;
3129
3130 case FileFullDirectoryInfo:
3131 case FileFullDirectoryRestartInfo:
3134 (class == FileFullDirectoryRestartInfo) );
3135 break;
3136
3137 case FileIdExtdDirectoryInfo:
3138 case FileIdExtdDirectoryRestartInfo:
3141 (class == FileIdExtdDirectoryRestartInfo) );
3142 break;
3143
3144 case FileRenameInfo:
3145 case FileDispositionInfo:
3146 case FileAllocationInfo:
3147 case FileIoPriorityHintInfo:
3148 case FileEndOfFileInfo:
3149 default:
3151 return FALSE;
3152 }
3153 return set_ntstatus( status );
3154}
3155
3156
3157/***********************************************************************
3158 * GetFileSize (kernelbase.@)
3159 */
3161{
3163
3164 if (!GetFileSizeEx( file, &size )) return INVALID_FILE_SIZE;
3165 if (size_high) *size_high = size.u.HighPart;
3166 if (size.u.LowPart == INVALID_FILE_SIZE) SetLastError( 0 );
3167 return size.u.LowPart;
3168}
3169
3170
3171/***********************************************************************
3172 * GetFileSizeEx (kernelbase.@)
3173 */
3175{
3178
3180 return FALSE;
3181
3182 *size = info.EndOfFile;
3183 return TRUE;
3184}
3185
3186
3187/***********************************************************************
3188 * GetFileTime (kernelbase.@)
3189 */
3192{
3195
3197 return FALSE;
3198
3199 if (creation)
3200 {
3201 creation->dwHighDateTime = info.CreationTime.u.HighPart;
3202 creation->dwLowDateTime = info.CreationTime.u.LowPart;
3203 }
3204 if (access)
3205 {
3206 access->dwHighDateTime = info.LastAccessTime.u.HighPart;
3207 access->dwLowDateTime = info.LastAccessTime.u.LowPart;
3208 }
3209 if (write)
3210 {
3211 write->dwHighDateTime = info.LastWriteTime.u.HighPart;
3212 write->dwLowDateTime = info.LastWriteTime.u.LowPart;
3213 }
3214 return TRUE;
3215}
3216
3217
3218/***********************************************************************
3219 * GetFileType (kernelbase.@)
3220 */
3222{
3225
3226 if (file == (HANDLE)STD_INPUT_HANDLE ||
3230
3233 return FILE_TYPE_UNKNOWN;
3234
3235 switch (info.DeviceType)
3236 {
3237 case FILE_DEVICE_NULL:
3241 case FILE_DEVICE_TAPE:
3243 return FILE_TYPE_CHAR;
3245 return FILE_TYPE_PIPE;
3246 default:
3247 return FILE_TYPE_DISK;
3248 }
3249}
3250
3251
3252/***********************************************************************
3253 * GetOverlappedResult (kernelbase.@)
3254 */
3256 LPDWORD result, BOOL wait )
3257{
3258 return GetOverlappedResultEx( file, overlapped, result, wait ? INFINITE : 0, FALSE );
3259}
3260
3261
3262/***********************************************************************
3263 * GetOverlappedResultEx (kernelbase.@)
3264 */
3266 DWORD *result, DWORD timeout, BOOL alertable )
3267{
3269 DWORD ret;
3270
3271 TRACE( "(%p %p %p %lu %d)\n", file, overlapped, result, timeout, alertable );
3272
3273 /* Paired with the write-release in set_async_iosb() in ntdll; see the
3274 * latter for details. */
3275 status = ReadAcquire( (LONG *)&overlapped->Internal );
3276 if (status == STATUS_PENDING)
3277 {
3278 if (!timeout)
3279 {
3281 return FALSE;
3282 }
3283 ret = WaitForSingleObjectEx( overlapped->hEvent ? overlapped->hEvent : file, timeout, alertable );
3284 if (ret == WAIT_FAILED)
3285 return FALSE;
3286 else if (ret)
3287 {
3288 SetLastError( ret );
3289 return FALSE;
3290 }
3291
3292 /* We don't need to give this load acquire semantics; the wait above
3293 * already guarantees that the IOSB and output buffer are filled. */
3294 status = overlapped->Internal;
3296 }
3297
3298 *result = overlapped->InternalHigh;
3299 return set_ntstatus( status );
3300}
3301
3302
3303/**************************************************************************
3304 * LockFile (kernelbase.@)
3305 */
3307 DWORD count_low, DWORD count_high )
3308{
3310
3311 TRACE( "%p %lx%08lx %lx%08lx\n", file, offset_high, offset_low, count_high, count_low );
3312
3313 count.u.LowPart = count_low;
3314 count.u.HighPart = count_high;
3315 offset.u.LowPart = offset_low;
3316 offset.u.HighPart = offset_high;
3317 return set_ntstatus( NtLockFile( file, 0, NULL, NULL, NULL, &offset, &count, NULL, TRUE, TRUE ));
3318}
3319
3320
3321/**************************************************************************
3322 * LockFileEx (kernelbase.@)
3323 */
3325 DWORD count_low, DWORD count_high, LPOVERLAPPED overlapped )
3326{
3328 LPVOID cvalue = NULL;
3329
3330 if (reserved)
3331 {
3333 return FALSE;
3334 }
3335
3336 TRACE( "%p %lx%08lx %lx%08lx flags %lx\n",
3337 file, overlapped->OffsetHigh, overlapped->Offset, count_high, count_low, flags );
3338
3339 count.u.LowPart = count_low;
3340 count.u.HighPart = count_high;
3341 offset.u.LowPart = overlapped->Offset;
3342 offset.u.HighPart = overlapped->OffsetHigh;
3343
3344 if (((ULONG_PTR)overlapped->hEvent & 1) == 0) cvalue = overlapped;
3345
3346 return set_ntstatus( NtLockFile( file, overlapped->hEvent, NULL, cvalue,
3347 NULL, &offset, &count, NULL,
3350}
3351
3352
3353/***********************************************************************
3354 * OpenFileById (kernelbase.@)
3355 */
3357 DWORD share, LPSECURITY_ATTRIBUTES sec_attr, DWORD flags )
3358{
3359 UINT options;
3360 HANDLE result;
3363 UNICODE_STRING objectName;
3364
3365 if (!id)
3366 {
3368 return INVALID_HANDLE_VALUE;
3369 }
3370
3374 else
3381
3382 objectName.Length = sizeof(ULONGLONG);
3383 objectName.Buffer = (WCHAR *)&id->FileId;
3384 attr.Length = sizeof(attr);
3385 attr.RootDirectory = handle;
3386 attr.Attributes = 0;
3387 attr.ObjectName = &objectName;
3388 attr.SecurityDescriptor = sec_attr ? sec_attr->lpSecurityDescriptor : NULL;
3389 attr.SecurityQualityOfService = NULL;
3390 if (sec_attr && sec_attr->bInheritHandle) attr.Attributes |= OBJ_INHERIT;
3391
3393 share, OPEN_EXISTING, options, NULL, 0 )))
3394 return INVALID_HANDLE_VALUE;
3395 return result;
3396}
3397
3398
3399/***********************************************************************
3400 * ReOpenFile (kernelbase.@)
3401 */
3403{
3406 UNICODE_STRING empty = { 0 };
3409 HANDLE file;
3410
3411 TRACE("handle %p, access %#lx, sharing %#lx, attributes %#lx.\n", handle, access, sharing, attributes);
3412
3413 if (attributes & 0x7ffff) /* FILE_ATTRIBUTE_* flags are invalid */
3414 {
3416 return INVALID_HANDLE_VALUE;
3417 }
3418
3419 if (attributes & FILE_FLAG_DELETE_ON_CLOSE)
3420 access |= DELETE;
3421
3423 if (attributes & SECURITY_SQOS_PRESENT)
3424 {
3425 qos.Length = sizeof(qos);
3426 qos.ImpersonationLevel = (attributes >> 16) & 0x3;
3428 qos.EffectiveOnly = (attributes & SECURITY_EFFECTIVE_ONLY) != 0;
3429 attr.SecurityQualityOfService = &qos;
3430 }
3431
3433 0, sharing, FILE_OPEN, get_nt_file_options( attributes ), NULL, 0 );
3434 if (!set_ntstatus( status ))
3435 return INVALID_HANDLE_VALUE;
3436 return file;
3437}
3438
3439
3441{
3443 completion( RtlNtStatusToDosError( io->Status ), io->Information, (LPOVERLAPPED)io );
3444}
3445
3446/****************************************************************************
3447 * ReadDirectoryChangesW (kernelbase.@)
3448 */
3450 BOOL subtree, DWORD filter, LPDWORD returned,
3453{
3454 OVERLAPPED ov, *pov;
3457 LPVOID cvalue = NULL;
3458
3459 TRACE( "%p %p %08lx %d %08lx %p %p %p\n",
3460 handle, buffer, len, subtree, filter, returned, overlapped, completion );
3461
3462 if (!overlapped)
3463 {
3464 memset( &ov, 0, sizeof ov );
3465 ov.hEvent = CreateEventW( NULL, 0, 0, NULL );
3466 pov = &ov;
3467 }
3468 else
3469 {
3470 pov = overlapped;
3471 if (completion) cvalue = completion;
3472 else if (((ULONG_PTR)overlapped->hEvent & 1) == 0) cvalue = overlapped;
3473 }
3474
3475 ios = (PIO_STATUS_BLOCK)pov;
3476 ios->Status = STATUS_PENDING;
3477
3480 cvalue, ios, buffer, len, filter, subtree );
3481 if (status == STATUS_PENDING)
3482 {
3483 if (overlapped) return TRUE;
3485 if (returned) *returned = ios->Information;
3486 status = ios->Status;
3487 }
3488 if (!overlapped) CloseHandle( ov.hEvent );
3489 return set_ntstatus( status );
3490}
3491
3492
3493/***********************************************************************
3494 * ReadFile (kernelbase.@)
3495 */
3498{
3500 PLARGE_INTEGER poffset = NULL;
3503 HANDLE event = 0;
3505 LPVOID cvalue = NULL;
3506
3507 TRACE( "%p %p %ld %p %p\n", file, buffer, count, result, overlapped );
3508
3509 if (result) *result = 0;
3510
3511 if (overlapped)
3512 {
3513 offset.u.LowPart = overlapped->Offset;
3514 offset.u.HighPart = overlapped->OffsetHigh;
3515 poffset = &offset;
3516 event = overlapped->hEvent;
3518 if (((ULONG_PTR)event & 1) == 0) cvalue = overlapped;
3519 }
3520 else io_status->Information = 0;
3521 io_status->Status = STATUS_PENDING;
3522
3523 status = NtReadFile( file, event, NULL, cvalue, io_status, buffer, count, poffset, NULL);
3524
3525 if (status == STATUS_PENDING && !overlapped)
3526 {
3528 status = io_status->Status;
3529 }
3530
3531 if (result) *result = overlapped && status ? 0 : io_status->Information;
3532
3534 {
3535 if (overlapped != NULL)
3536 {
3538 return FALSE;
3539 }
3540 }
3541 else if (status && status != STATUS_TIMEOUT)
3542 {
3544 return FALSE;
3545 }
3546 return TRUE;
3547}
3548
3549
3550/***********************************************************************
3551 * ReadFileEx (kernelbase.@)
3552 */
3555{
3559
3560 TRACE( "(file=%p, buffer=%p, bytes=%lu, ovl=%p, ovl_fn=%p)\n",
3562
3563 if (!overlapped)
3564 {
3566 return FALSE;
3567 }
3568 offset.u.LowPart = overlapped->Offset;
3569 offset.u.HighPart = overlapped->OffsetHigh;
3571 io->Status = STATUS_PENDING;
3572 io->Information = 0;
3573
3575 if (status == STATUS_PENDING) return TRUE;
3576 return set_ntstatus( status );
3577}
3578
3579
3580/***********************************************************************
3581 * ReadFileScatter (kernelbase.@)
3582 */
3585{
3588 void *cvalue = NULL;
3589
3590 TRACE( "(%p %p %lu %p)\n", file, segments, count, overlapped );
3591
3592 offset.u.LowPart = overlapped->Offset;
3593 offset.u.HighPart = overlapped->OffsetHigh;
3594 if (!((ULONG_PTR)overlapped->hEvent & 1)) cvalue = overlapped;
3596 io->Status = STATUS_PENDING;
3597 io->Information = 0;
3598
3599 return set_ntstatus( NtReadFileScatter( file, overlapped->hEvent, NULL, cvalue, io,
3600 segments, count, &offset, NULL ));
3601}
3602
3603
3604/***********************************************************************
3605 * RemoveDirectoryA (kernelbase.@)
3606 */
3608{
3609 WCHAR *pathW;
3610
3611 if (!(pathW = file_name_AtoW( path, FALSE ))) return FALSE;
3612 return RemoveDirectoryW( pathW );
3613}
3614
3615
3616/***********************************************************************
3617 * RemoveDirectoryW (kernelbase.@)
3618 */
3620{
3622 UNICODE_STRING nt_name;
3625 HANDLE handle;
3626
3627 TRACE( "%s\n", debugstr_w(path) );
3628
3630 if (!set_ntstatus( status )) return FALSE;
3631
3636 RtlFreeUnicodeString( &nt_name );
3637
3638 if (!status)
3639 {
3642 NtClose( handle );
3643 }
3644 return set_ntstatus( status );
3645}
3646
3647
3648/**************************************************************************
3649 * SetEndOfFile (kernelbase.@)
3650 */
3652{
3657
3659 {
3660 eof.EndOfFile = pos.CurrentByteOffset;
3662 }
3663 return set_ntstatus( status );
3664}
3665
3666
3667/***********************************************************************
3668 * SetFileInformationByHandle (kernelbase.@)
3669 */
3671 void *info, DWORD size )
3672{
3675
3676 TRACE( "%p %u %p %lu\n", file, class, info, size );
3677
3678 switch (class)
3679 {
3680 case FileNameInfo:
3681 case FileAllocationInfo:
3682 case FileStreamInfo:
3683 case FileIdBothDirectoryInfo:
3684 case FileIdBothDirectoryRestartInfo:
3685 case FileFullDirectoryInfo:
3686 case FileFullDirectoryRestartInfo:
3687 case FileStorageInfo:
3688 case FileAlignmentInfo:
3689 case FileIdInfo:
3690 case FileIdExtdDirectoryInfo:
3691 case FileIdExtdDirectoryRestartInfo:
3692 FIXME( "%p, %u, %p, %lu\n", file, class, info, size );
3694 return FALSE;
3695
3696 case FileEndOfFileInfo:
3698 break;
3699 case FileBasicInfo:
3701 break;
3702 case FileDispositionInfo:
3704 break;
3705 case FileDispositionInfoEx:
3707 break;
3708 case FileIoPriorityHintInfo:
3710 break;
3711 case FileRenameInfo:
3712 {
3713 FILE_RENAME_INFORMATION *rename_info;
3714 UNICODE_STRING nt_name;
3715 ULONG size;
3716
3718 &nt_name, NULL, NULL )))
3719 break;
3720
3721 size = sizeof(*rename_info) + nt_name.Length;
3722 if ((rename_info = HeapAlloc( GetProcessHeap(), 0, size )))
3723 {
3724 memcpy( rename_info, info, sizeof(*rename_info) );
3725 memcpy( rename_info->FileName, nt_name.Buffer, nt_name.Length + sizeof(WCHAR) );
3726 rename_info->FileNameLength = nt_name.Length;
3728 HeapFree( GetProcessHeap(), 0, rename_info );
3729 }
3730 RtlFreeUnicodeString( &nt_name );
3731 break;
3732 }
3733 case FileStandardInfo:
3734 case FileCompressionInfo:
3735 case FileAttributeTagInfo:
3736 case FileRemoteProtocolInfo:
3737 default:
3739 return FALSE;
3740 }
3741 return set_ntstatus( status );
3742}
3743
3744
3745/***********************************************************************
3746 * SetFilePointer (kernelbase.@)
3747 */
3749{
3750 LARGE_INTEGER dist, newpos;
3751
3752 if (highword)
3753 {
3754 dist.u.LowPart = distance;
3755 dist.u.HighPart = *highword;
3756 }
3757 else dist.QuadPart = distance;
3758
3759 if (!SetFilePointerEx( file, dist, &newpos, method )) return INVALID_SET_FILE_POINTER;
3760
3761 if (highword) *highword = newpos.u.HighPart;
3762 if (newpos.u.LowPart == INVALID_SET_FILE_POINTER) SetLastError( 0 );
3763 return newpos.u.LowPart;
3764}
3765
3766
3767/***********************************************************************
3768 * SetFilePointerEx (kernelbase.@)
3769 */
3771 LARGE_INTEGER *newpos, DWORD method )
3772{
3773 LONGLONG pos;
3777
3778 switch(method)
3779 {
3780 case FILE_BEGIN:
3781 pos = distance.QuadPart;
3782 break;
3783 case FILE_CURRENT:
3785 goto error;
3786 pos = info.CurrentByteOffset.QuadPart + distance.QuadPart;
3787 break;
3788 case FILE_END:
3790 goto error;
3791 pos = eof.EndOfFile.QuadPart + distance.QuadPart;
3792 break;
3793 default:
3795 return FALSE;
3796 }
3797
3798 if (pos < 0)
3799 {
3801 return FALSE;
3802 }
3803
3804 info.CurrentByteOffset.QuadPart = pos;
3806 {
3807 if (newpos) newpos->QuadPart = pos;
3808 return TRUE;
3809 }
3810
3811error:
3812 return set_ntstatus( io.Status );
3813}
3814
3815
3816/***********************************************************************
3817 * SetFileTime (kernelbase.@)
3818 */
3820 const FILETIME *atime, const FILETIME *mtime )
3821{
3824
3825 memset( &info, 0, sizeof(info) );
3826 if (ctime)
3827 {
3828 info.CreationTime.u.HighPart = ctime->dwHighDateTime;
3829 info.CreationTime.u.LowPart = ctime->dwLowDateTime;
3830 }
3831 if (atime)
3832 {
3833 info.LastAccessTime.u.HighPart = atime->dwHighDateTime;
3834 info.LastAccessTime.u.LowPart = atime->dwLowDateTime;
3835 }
3836 if (mtime)
3837 {
3838 info.LastWriteTime.u.HighPart = mtime->dwHighDateTime;
3839 info.LastWriteTime.u.LowPart = mtime->dwLowDateTime;
3840 }
3841
3843}
3844
3845
3846/***********************************************************************
3847 * SetFileValidData (kernelbase.@)
3848 */
3850{
3853
3854 info.ValidDataLength.QuadPart = length;
3855 return set_ntstatus( NtSetInformationFile( file, &io, &info, sizeof(info),
3857}
3858
3859
3860/**************************************************************************
3861 * UnlockFile (kernelbase.@)
3862 */
3864 DWORD count_low, DWORD count_high )
3865{
3867
3868 count.u.LowPart = count_low;
3869 count.u.HighPart = count_high;
3870 offset.u.LowPart = offset_low;
3871 offset.u.HighPart = offset_high;
3873}
3874
3875
3876/**************************************************************************
3877 * UnlockFileEx (kernelbase.@)
3878 */
3880 DWORD count_low, DWORD count_high, LPOVERLAPPED overlapped )
3881{
3882 if (reserved)
3883 {
3885 return FALSE;
3886 }
3887 if (overlapped->hEvent) FIXME("Unimplemented overlapped operation\n");
3888
3889 return UnlockFile( file, overlapped->Offset, overlapped->OffsetHigh, count_low, count_high );
3890}
3891
3892
3893/***********************************************************************
3894 * WriteFile (kernelbase.@)
3895 */
3898{
3899 HANDLE event = NULL;
3901 PLARGE_INTEGER poffset = NULL;
3904 PIO_STATUS_BLOCK piosb = &iosb;
3905 LPVOID cvalue = NULL;
3906
3907 TRACE( "%p %p %ld %p %p\n", file, buffer, count, result, overlapped );
3908
3909 if (overlapped)
3910 {
3911 offset.u.LowPart = overlapped->Offset;
3912 offset.u.HighPart = overlapped->OffsetHigh;
3913 poffset = &offset;
3914 event = overlapped->hEvent;
3916 if (((ULONG_PTR)event & 1) == 0) cvalue = overlapped;
3917 }
3918 else piosb->Information = 0;
3919 piosb->Status = STATUS_PENDING;
3920
3921 status = NtWriteFile( file, event, NULL, cvalue, piosb, buffer, count, poffset, NULL );
3922
3923 if (status == STATUS_PENDING && !overlapped)
3924 {
3926 status = piosb->Status;
3927 }
3928
3929 if (result) *result = overlapped && status ? 0 : piosb->Information;
3930
3931 if (status && status != STATUS_TIMEOUT)
3932 {
3934 return FALSE;
3935 }
3936 return TRUE;
3937}
3938
3939
3940/***********************************************************************
3941 * WriteFileEx (kernelbase.@)
3942 */
3946{
3950
3951 TRACE( "%p %p %ld %p %p\n", file, buffer, count, overlapped, completion );
3952
3953 if (!overlapped)
3954 {
3956 return FALSE;
3957 }
3958 offset.u.LowPart = overlapped->Offset;
3959 offset.u.HighPart = overlapped->OffsetHigh;
3960
3962 io->Status = STATUS_PENDING;
3963 io->Information = 0;
3964
3966 if (status == STATUS_PENDING) return TRUE;
3967 return set_ntstatus( status );
3968}
3969
3970
3971/***********************************************************************
3972 * WriteFileGather (kernelbase.@)
3973 */
3976{
3979 void *cvalue = NULL;
3980
3981 TRACE( "%p %p %lu %p\n", file, segments, count, overlapped );
3982
3983 offset.u.LowPart = overlapped->Offset;
3984 offset.u.HighPart = overlapped->OffsetHigh;
3985 if (!((ULONG_PTR)overlapped->hEvent & 1)) cvalue = overlapped;
3987 io->Status = STATUS_PENDING;
3988 io->Information = 0;
3989
3990 return set_ntstatus( NtWriteFileGather( file, overlapped->hEvent, NULL, cvalue,
3991 io, segments, count, &offset, NULL ));
3992}
3993
3994
3995/***********************************************************************
3996 * Operations on file times
3997 ***********************************************************************/
3998
3999
4000/*********************************************************************
4001 * CompareFileTime (kernelbase.@)
4002 */
4004{
4005 if (!x || !y) return -1;
4006 if (x->dwHighDateTime > y->dwHighDateTime) return 1;
4007 if (x->dwHighDateTime < y->dwHighDateTime) return -1;
4008 if (x->dwLowDateTime > y->dwLowDateTime) return 1;
4009 if (x->dwLowDateTime < y->dwLowDateTime) return -1;
4010 return 0;
4011}
4012
4013
4014/*********************************************************************
4015 * FileTimeToLocalFileTime (kernelbase.@)
4016 */
4018{
4020}
4021
4022
4023/*********************************************************************
4024 * FileTimeToSystemTime (kernelbase.@)
4025 */
4027{
4029 const LARGE_INTEGER *li = (const LARGE_INTEGER *)ft;
4030
4031 if (li->QuadPart < 0)
4032 {
4034 return FALSE;
4035 }
4037 systime->wYear = tf.Year;
4038 systime->wMonth = tf.Month;
4039 systime->wDay = tf.Day;
4040 systime->wHour = tf.Hour;
4041 systime->wMinute = tf.Minute;
4042 systime->wSecond = tf.Second;
4043 systime->wMilliseconds = tf.Milliseconds;
4044 systime->wDayOfWeek = tf.Weekday;
4045 return TRUE;
4046}
4047
4048
4049/*********************************************************************
4050 * GetLocalTime (kernelbase.@)
4051 */
4053{
4054 LARGE_INTEGER ft, ft2;
4055
4056 NtQuerySystemTime( &ft );
4057 RtlSystemTimeToLocalTime( &ft, &ft2 );
4058 FileTimeToSystemTime( (FILETIME *)&ft2, systime );
4059}
4060
4061
4062/*********************************************************************
4063 * GetSystemTime (kernelbase.@)
4064 */
4066{
4067 LARGE_INTEGER ft;
4068
4069 NtQuerySystemTime( &ft );
4070 FileTimeToSystemTime( (FILETIME *)&ft, systime );
4071}
4072
4073
4074/***********************************************************************
4075 * GetSystemTimeAdjustment (kernelbase.@)
4076 */
4078{
4079 SYSTEM_TIME_ADJUSTMENT_QUERY st;
4080 ULONG len;
4081
4083 return FALSE;
4084 *adjust = st.TimeAdjustment;
4085 *increment = st.TimeIncrement;
4086 *disabled = st.TimeAdjustmentDisabled;
4087 return TRUE;
4088}
4089
4090
4091/***********************************************************************
4092 * GetSystemTimeAsFileTime (kernelbase.@)
4093 */
4095{
4097}
4098
4099
4100/***********************************************************************
4101 * GetSystemTimePreciseAsFileTime (kernelbase.@)
4102 */
4104{
4106
4107 t.QuadPart = RtlGetSystemTimePrecise();
4108 time->dwLowDateTime = t.u.LowPart;
4109 time->dwHighDateTime = t.u.HighPart;
4110}
4111
4112
4113/*********************************************************************
4114 * LocalFileTimeToFileTime (kernelbase.@)
4115 */
4117{
4119}
4120
4121
4122/***********************************************************************
4123 * SetLocalTime (kernelbase.@)
4124 */
4126{
4127 FILETIME ft;
4128 LARGE_INTEGER st;
4129
4130 if (!SystemTimeToFileTime( systime, &ft )) return FALSE;
4132 return set_ntstatus( NtSetSystemTime( &st, NULL ));
4133}
4134
4135
4136/***********************************************************************
4137 * SetSystemTime (kernelbase.@)
4138 */
4140{
4141 FILETIME ft;
4142
4143 if (!SystemTimeToFileTime( systime, &ft )) return FALSE;
4144 return set_ntstatus( NtSetSystemTime( (LARGE_INTEGER *)&ft, NULL ));
4145}
4146
4147
4148/***********************************************************************
4149 * SetSystemTimeAdjustment (kernelbase.@)
4150 */
4152{
4154
4155 st.TimeAdjustment = adjust;
4156 st.TimeAdjustmentDisabled = disabled;
4158}
4159
4160
4161/*********************************************************************
4162 * SystemTimeToFileTime (kernelbase.@)
4163 */
4165{
4167
4168 tf.Year = systime->wYear;
4169 tf.Month = systime->wMonth;
4170 tf.Day = systime->wDay;
4171 tf.Hour = systime->wHour;
4172 tf.Minute = systime->wMinute;
4173 tf.Second = systime->wSecond;
4174 tf.Milliseconds = systime->wMilliseconds;
4175 if (RtlTimeFieldsToTime( &tf, (LARGE_INTEGER *)ft )) return TRUE;
4177 return FALSE;
4178}
4179
4180
4181/***********************************************************************
4182 * I/O controls
4183 ***********************************************************************/
4184
4185
4186static void dump_dcb( const DCB *dcb )
4187{
4188 TRACE( "size=%d rate=%ld fParity=%d Parity=%d stopbits=%d %sIXON %sIXOFF CTS=%d RTS=%d DSR=%d DTR=%d %sCRTSCTS\n",
4189 dcb->ByteSize, dcb->BaudRate, dcb->fParity, dcb->Parity,
4190 (dcb->StopBits == ONESTOPBIT) ? 1 : (dcb->StopBits == TWOSTOPBITS) ? 2 : 0,
4191 dcb->fOutX ? "" : "~", dcb->fInX ? "" : "~",
4192 dcb->fOutxCtsFlow, dcb->fRtsControl, dcb->fOutxDsrFlow, dcb->fDtrControl,
4193 (dcb->fOutxCtsFlow || dcb->fRtsControl == RTS_CONTROL_HANDSHAKE) ? "" : "~" );
4194}
4195
4196/*****************************************************************************
4197 * ClearCommBreak (kernelbase.@)
4198 */
4200{
4202}
4203
4204
4205/*****************************************************************************
4206 * ClearCommError (kernelbase.@)
4207 */
4209{
4211
4213 return FALSE;
4214
4215 TRACE( "status %#lx,%#lx, in %lu, out %lu, eof %d, wait %d\n", ss.Errors, ss.HoldReasons,
4216 ss.AmountInInQueue, ss.AmountInOutQueue, ss.EofReceived, ss.WaitForImmediate );
4217
4218 if (errors)
4219 {
4220 *errors = 0;
4221 if (ss.Errors & SERIAL_ERROR_BREAK) *errors |= CE_BREAK;
4222 if (ss.Errors & SERIAL_ERROR_FRAMING) *errors |= CE_FRAME;
4223 if (ss.Errors & SERIAL_ERROR_OVERRUN) *errors |= CE_OVERRUN;
4224 if (ss.Errors & SERIAL_ERROR_QUEUEOVERRUN) *errors |= CE_RXOVER;
4225 if (ss.Errors & SERIAL_ERROR_PARITY) *errors |= CE_RXPARITY;
4226 }
4227 if (stat)
4228 {
4229 stat->fCtsHold = !!(ss.HoldReasons & SERIAL_TX_WAITING_FOR_CTS);
4230 stat->fDsrHold = !!(ss.HoldReasons & SERIAL_TX_WAITING_FOR_DSR);
4231 stat->fRlsdHold = !!(ss.HoldReasons & SERIAL_TX_WAITING_FOR_DCD);
4232 stat->fXoffHold = !!(ss.HoldReasons & SERIAL_TX_WAITING_FOR_XON);
4233 stat->fXoffSent = !!(ss.HoldReasons & SERIAL_TX_WAITING_XOFF_SENT);
4234 stat->fEof = !!ss.EofReceived;
4235 stat->fTxim = !!ss.WaitForImmediate;
4236 stat->cbInQue = ss.AmountInInQueue;
4237 stat->cbOutQue = ss.AmountInOutQueue;
4238 }
4239 return TRUE;
4240}
4241
4242
4243/****************************************************************************
4244 * DeviceIoControl (kernelbase.@)
4245 */
4247 void *out_buff, DWORD out_count, DWORD *returned,
4249{
4250 IO_STATUS_BLOCK iosb, *piosb = &iosb;
4251 void *cvalue = NULL;
4252 HANDLE event = 0;
4254
4255 TRACE( "(%p,%lx,%p,%ld,%p,%ld,%p,%p)\n",
4256 handle, code, in_buff, in_count, out_buff, out_count, returned, overlapped );
4257
4258 if (overlapped)
4259 {
4260 piosb = (IO_STATUS_BLOCK *)overlapped;
4261 if (!((ULONG_PTR)overlapped->hEvent & 1)) cvalue = overlapped;
4262 event = overlapped->hEvent;
4263 overlapped->Internal = STATUS_PENDING;
4264 overlapped->InternalHigh = 0;
4265 }
4266
4268 status = NtFsControlFile( handle, event, NULL, cvalue, piosb, code,
4269 in_buff, in_count, out_buff, out_count );
4270 else
4271 status = NtDeviceIoControlFile( handle, event, NULL, cvalue, piosb, code,
4272 in_buff, in_count, out_buff, out_count );
4273
4274 if (returned && !NT_ERROR(status)) *returned = piosb->Information;
4275 if (status == STATUS_PENDING || !NT_SUCCESS( status )) return set_ntstatus( status );
4276 return TRUE;
4277}
4278
4279
4280/*****************************************************************************
4281 * EscapeCommFunction (kernelbase.@)
4282 */
4284{
4285 static const DWORD ioctls[] =
4286 {
4287 0,
4288 IOCTL_SERIAL_SET_XOFF, /* SETXOFF */
4289 IOCTL_SERIAL_SET_XON, /* SETXON */
4290 IOCTL_SERIAL_SET_RTS, /* SETRTS */
4291 IOCTL_SERIAL_CLR_RTS, /* CLRRTS */
4292 IOCTL_SERIAL_SET_DTR, /* SETDTR */
4293 IOCTL_SERIAL_CLR_DTR, /* CLRDTR */
4294 IOCTL_SERIAL_RESET_DEVICE, /* RESETDEV */
4295 IOCTL_SERIAL_SET_BREAK_ON, /* SETBREAK */
4296 IOCTL_SERIAL_SET_BREAK_OFF /* CLRBREAK */
4297 };
4298
4299 if (func >= ARRAY_SIZE(ioctls) || !ioctls[func])
4300 {
4302 return FALSE;
4303 }
4304 return DeviceIoControl( handle, ioctls[func], NULL, 0, NULL, 0, NULL, NULL );
4305}
4306
4307
4308/***********************************************************************
4309 * GetCommConfig (kernelbase.@)
4310 */
4312{
4313 if (!config) return FALSE;
4314
4315 TRACE( "(%p, %p, %p %lu)\n", handle, config, size, *size );
4316
4317 if (*size < sizeof(COMMCONFIG))
4318 {
4319 *size = sizeof(COMMCONFIG);
4320 return FALSE;
4321 }
4322 *size = sizeof(COMMCONFIG);
4323 config->dwSize = sizeof(COMMCONFIG);
4324 config->wVersion = 1;
4325 config->wReserved = 0;
4326 config->dwProviderSubType = PST_RS232;
4327 config->dwProviderOffset = 0;
4328 config->dwProviderSize = 0;
4329 return GetCommState( handle, &config->dcb );
4330}
4331
4332
4333/*****************************************************************************
4334 * GetCommMask (kernelbase.@)
4335 */
4337{
4339 NULL, NULL );
4340}
4341
4342
4343/***********************************************************************
4344 * GetCommModemStatus (kernelbase.@)
4345 */
4347{
4349 NULL, NULL );
4350}
4351
4352
4353/***********************************************************************
4354 * GetCommProperties (kernelbase.@)
4355 */
4357{
4358 return DeviceIoControl( handle, IOCTL_SERIAL_GET_PROPERTIES, NULL, 0, prop, sizeof(*prop), NULL, NULL );
4359}
4360
4361
4362/*****************************************************************************
4363 * GetCommState (kernelbase.@)
4364 */
4366{
4367 SERIAL_BAUD_RATE sbr;
4369 SERIAL_HANDFLOW shf;
4370 SERIAL_CHARS sc;
4371
4372 if (!dcb)
4373 {
4375 return FALSE;
4376 }
4377 if (!DeviceIoControl(handle, IOCTL_SERIAL_GET_BAUD_RATE, NULL, 0, &sbr, sizeof(sbr), NULL, NULL) ||
4378 !DeviceIoControl(handle, IOCTL_SERIAL_GET_LINE_CONTROL, NULL, 0, &slc, sizeof(slc), NULL, NULL) ||
4379 !DeviceIoControl(handle, IOCTL_SERIAL_GET_HANDFLOW, NULL, 0, &shf, sizeof(shf), NULL, NULL) ||
4380 !DeviceIoControl(handle, IOCTL_SERIAL_GET_CHARS, NULL, 0, &sc, sizeof(sc), NULL, NULL))
4381 return FALSE;
4382
4383 dcb->DCBlength = sizeof(*dcb);
4384 dcb->BaudRate = sbr.BaudRate;
4385 /* yes, they seem no never be (re)set on NT */
4386 dcb->fBinary = 1;
4387 dcb->fParity = 0;
4388 dcb->fOutxCtsFlow = !!(shf.ControlHandShake & SERIAL_CTS_HANDSHAKE);
4389 dcb->fOutxDsrFlow = !!(shf.ControlHandShake & SERIAL_DSR_HANDSHAKE);
4390 dcb->fDsrSensitivity = !!(shf.ControlHandShake & SERIAL_DSR_SENSITIVITY);
4391 dcb->fTXContinueOnXoff = !!(shf.FlowReplace & SERIAL_XOFF_CONTINUE);
4392 dcb->fOutX = !!(shf.FlowReplace & SERIAL_AUTO_TRANSMIT);
4393 dcb->fInX = !!(shf.FlowReplace & SERIAL_AUTO_RECEIVE);
4394 dcb->fErrorChar = !!(shf.FlowReplace & SERIAL_ERROR_CHAR);
4395 dcb->fNull = !!(shf.FlowReplace & SERIAL_NULL_STRIPPING);
4396 dcb->fAbortOnError = !!(shf.ControlHandShake & SERIAL_ERROR_ABORT);
4397 dcb->XonLim = shf.XonLimit;
4398 dcb->XoffLim = shf.XoffLimit;
4399 dcb->ByteSize = slc.WordLength;
4400 dcb->Parity = slc.Parity;
4401 dcb->StopBits = slc.StopBits;
4402 dcb->XonChar = sc.XonChar;
4403 dcb->XoffChar = sc.XoffChar;
4404 dcb->ErrorChar = sc.ErrorChar;
4405 dcb->EofChar = sc.EofChar;
4406 dcb->EvtChar = sc.EventChar;
4407
4409 {
4410 case SERIAL_DTR_CONTROL: dcb->fDtrControl = DTR_CONTROL_ENABLE; break;
4411 case SERIAL_DTR_HANDSHAKE: dcb->fDtrControl = DTR_CONTROL_HANDSHAKE; break;
4412 default: dcb->fDtrControl = DTR_CONTROL_DISABLE; break;
4413 }
4415 {
4416 case SERIAL_RTS_CONTROL: dcb->fRtsControl = RTS_CONTROL_ENABLE; break;
4417 case SERIAL_RTS_HANDSHAKE: dcb->fRtsControl = RTS_CONTROL_HANDSHAKE; break;
4419 dcb->fRtsControl = RTS_CONTROL_TOGGLE; break;
4420 default: dcb->fRtsControl = RTS_CONTROL_DISABLE; break;
4421 }
4422 dump_dcb( dcb );
4423 return TRUE;
4424}
4425
4426
4427/*****************************************************************************
4428 * GetCommTimeouts (kernelbase.@)
4429 */
4431{
4432 if (!timeouts)
4433 {
4435 return FALSE;
4436 }
4438 NULL, NULL );
4439}
4440
4441/********************************************************************
4442 * PurgeComm (kernelbase.@)
4443 */
4445{
4447 NULL, 0, NULL, NULL );
4448}
4449
4450
4451/*****************************************************************************
4452 * SetCommBreak (kernelbase.@)
4453 */
4455{
4457}
4458
4459
4460/***********************************************************************
4461 * SetCommConfig (kernelbase.@)
4462 */
4464{
4465 TRACE( "(%p, %p, %lu)\n", handle, config, size );
4466 return SetCommState( handle, &config->dcb );
4467}
4468
4469
4470/*****************************************************************************
4471 * SetCommMask (kernelbase.@)
4472 */
4474{
4476 NULL, 0, NULL, NULL );
4477}
4478
4479
4480/*****************************************************************************
4481 * SetCommState (kernelbase.@)
4482 */
4484{
4485 SERIAL_BAUD_RATE sbr;
4487 SERIAL_HANDFLOW shf;
4488 SERIAL_CHARS sc;
4489
4490 if (!dcb)
4491 {
4493 return FALSE;
4494 }
4495 dump_dcb( dcb );
4496
4497 sbr.BaudRate = dcb->BaudRate;
4498 slc.StopBits = dcb->StopBits;
4499 slc.Parity = dcb->Parity;
4500 slc.WordLength = dcb->ByteSize;
4501 shf.ControlHandShake = 0;
4502 shf.FlowReplace = 0;
4503 if (dcb->fOutxCtsFlow) shf.ControlHandShake |= SERIAL_CTS_HANDSHAKE;
4504 if (dcb->fOutxDsrFlow) shf.ControlHandShake |= SERIAL_DSR_HANDSHAKE;
4505 switch (dcb->fDtrControl)
4506 {
4507 case DTR_CONTROL_DISABLE: break;
4510 default:
4512 return FALSE;
4513 }
4514 switch (dcb->fRtsControl)
4515 {
4516 case RTS_CONTROL_DISABLE: break;
4520 default:
4522 return FALSE;
4523 }
4524 if (dcb->fDsrSensitivity) shf.ControlHandShake |= SERIAL_DSR_SENSITIVITY;
4525 if (dcb->fAbortOnError) shf.ControlHandShake |= SERIAL_ERROR_ABORT;
4526 if (dcb->fErrorChar) shf.FlowReplace |= SERIAL_ERROR_CHAR;
4527 if (dcb->fNull) shf.FlowReplace |= SERIAL_NULL_STRIPPING;
4528 if (dcb->fTXContinueOnXoff) shf.FlowReplace |= SERIAL_XOFF_CONTINUE;
4529 if (dcb->fOutX) shf.FlowReplace |= SERIAL_AUTO_TRANSMIT;
4530 if (dcb->fInX) shf.FlowReplace |= SERIAL_AUTO_RECEIVE;
4531 shf.XonLimit = dcb->XonLim;
4532 shf.XoffLimit = dcb->XoffLim;
4533 sc.EofChar = dcb->EofChar;
4534 sc.ErrorChar = dcb->ErrorChar;
4535 sc.BreakChar = 0;
4536 sc.EventChar = dcb->EvtChar;
4537 sc.XonChar = dcb->XonChar;
4538 sc.XoffChar = dcb->XoffChar;
4539
4540 /* note: change DTR/RTS lines after setting the comm attributes,
4541 * so flow control does not interfere.
4542 */
4543 return (DeviceIoControl( handle, IOCTL_SERIAL_SET_BAUD_RATE, &sbr, sizeof(sbr), NULL, 0, NULL, NULL ) &&
4544 DeviceIoControl( handle, IOCTL_SERIAL_SET_LINE_CONTROL, &slc, sizeof(slc), NULL, 0, NULL, NULL ) &&
4545 DeviceIoControl( handle, IOCTL_SERIAL_SET_HANDFLOW, &shf, sizeof(shf), NULL, 0, NULL, NULL ) &&
4546 DeviceIoControl( handle, IOCTL_SERIAL_SET_CHARS, &sc, sizeof(sc), NULL, 0, NULL, NULL ));
4547}
4548
4549
4550/*****************************************************************************
4551 * SetCommTimeouts (kernelbase.@)
4552 */
4554{
4555 if (!timeouts)
4556 {
4558 return FALSE;
4559 }
4561 NULL, 0, NULL, NULL );
4562}
4563
4564
4565/*****************************************************************************
4566 * SetupComm (kernelbase.@)
4567 */
4569{
4571
4572 sqs.InSize = in_size;
4573 sqs.OutSize = out_size;
4574 return DeviceIoControl( handle, IOCTL_SERIAL_SET_QUEUE_SIZE, &sqs, sizeof(sqs), NULL, 0, NULL, NULL );
4575}
4576
4577
4578/*****************************************************************************
4579 * TransmitCommChar (kernelbase.@)
4580 */
4582{
4583 return DeviceIoControl( handle, IOCTL_SERIAL_IMMEDIATE_CHAR, &ch, sizeof(ch), NULL, 0, NULL, NULL );
4584}
4585
4586
4587/***********************************************************************
4588 * WaitCommEvent (kernelbase.@)
4589 */
4591{
4593 NULL, overlapped );
4594}
4595
4596
4597/***********************************************************************
4598 * QueryIoRingCapabilities (kernelbase.@)
4599 */
4600HRESULT WINAPI QueryIoRingCapabilities(IORING_CAPABILITIES *caps)
4601{
4602 FIXME( "caps %p stub.\n", caps );
4603
4604 return E_NOTIMPL;
4605}
NTSYSAPI NTSTATUS NTAPI NtSetSystemInformation(IN INT SystemInformationClass, IN PVOID SystemInformation, IN ULONG SystemInformationLength)
@ ObjectNameInformation
Definition: DriverTester.h:55
NTSTATUS NtQueryObject(IN HANDLE Handle, IN OBJECT_INFO_CLASS ObjectInformationClass, OUT PVOID ObjectInformation, IN ULONG ObjectInformationLength, OUT PULONG ReturnLength)
unsigned char BOOLEAN
void CALLBACK completion(DWORD dwError, DWORD cbTransferred, LPWSAOVERLAPPED lpOverlapped, DWORD dwFlags)
Definition: WSARecv.c:16
basic_ios< char, char_traits< char > > ios
Definition: _iosfwd.h:78
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define write
Definition: acwin.h:97
static struct sockaddr_in sa
Definition: adnsresfilter.c:69
unsigned int dir
Definition: maze.c:112
static long backup()
Definition: maze.c:403
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
LONG NTSTATUS
Definition: precomp.h:26
static const WCHAR nameW[]
Definition: main.c:49
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
#define FILE_DELETE_ON_CLOSE
Definition: constants.h:494
#define ARRAY_SIZE(A)
Definition: main.h:20
struct timeout * timeouts
Definition: dispatch.c:57
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
Definition: console.c:203
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
static HANDLE thread
Definition: service.c:33
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:616
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:634
#define FileIdExtdDirectoryInformation
Definition: dirctrl.c:24
cd_progress_ptr progress
Definition: cdjpeg.h:152
#define STATUS_TIMEOUT
Definition: d3dkmdt.h:49
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define STATUS_NO_MEMORY
Definition: d3dkmdt.h:51
const WCHAR * link
Definition: db.cpp:997
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define E_NOTIMPL
Definition: ddrawi.h:99
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
NTSYSAPI NTSTATUS NTAPI RtlWow64EnableFsRedirection(IN BOOLEAN Wow64FsEnableRedirection)
Definition: libsupp.c:1166
NTSYSAPI NTSTATUS NTAPI RtlWow64EnableFsRedirectionEx(IN PVOID Wow64FsEnableRedirection, OUT PVOID *OldFsRedirectionLevel)
Definition: libsupp.c:1178
static __inline BOOL set_ntstatus(NTSTATUS status)
Definition: security.c:227
static const WCHAR empty[]
Definition: main.c:47
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define IMAGE_FILE_MACHINE_ARMNT
Definition: compat.h:127
#define GetProcessHeap()
Definition: compat.h:736
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define FILE_BEGIN
Definition: compat.h:761
#define INVALID_SET_FILE_POINTER
Definition: compat.h:732
#define wcsnicmp
Definition: compat.h:14
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:756
#define wcsrchr
Definition: compat.h:16
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:755
#define OPEN_EXISTING
Definition: compat.h:775
#define ReadFile(a, b, c, d, e)
Definition: compat.h:742
#define SetFilePointer
Definition: compat.h:743
#define SetLastError(x)
Definition: compat.h:752
#define GetProcAddress(x, y)
Definition: compat.h:753
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:740
#define __TRY
Definition: compat.h:80
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define __ENDTRY
Definition: compat.h:82
#define GetFileSizeEx
Definition: compat.h:757
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrcpyW
Definition: compat.h:749
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define FILE_SHARE_READ
Definition: compat.h:136
#define ERROR_INVALID_NAME
Definition: compat.h:103
#define __EXCEPT_PAGE_FAULT
Definition: compat.h:81
#define wcsicmp
Definition: compat.h:15
#define lstrcpynW
Definition: compat.h:738
#define lstrlenW
Definition: compat.h:750
static const WCHAR *const ext[]
Definition: module.c:53
static DOUBLE utc(DOUBLE time, DateInstance *date)
Definition: date.c:357
DWORD WINAPI QueryDosDeviceW(LPCWSTR lpDeviceName, LPWSTR lpTargetPath, DWORD ucchMax)
Definition: dosdev.c:542
BOOL NTAPI IsBadStringPtrA(IN LPCSTR lpsz, IN UINT_PTR ucchMax)
Definition: except.c:989
BOOL WINAPI GetVolumePathNameW(IN LPCWSTR lpszFileName, IN LPWSTR lpszVolumePathName, IN DWORD cchBufferLength)
Definition: volume.c:815
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
BOOL WINAPI DECLSPEC_HOTPATCH DeviceIoControl(HANDLE handle, DWORD code, void *in_buff, DWORD in_count, void *out_buff, DWORD out_count, DWORD *returned, OVERLAPPED *overlapped)
Definition: file.c:4246
static const WCHAR * get_machine_wow64_dir(WORD machine)
Definition: file.c:79
BOOL WINAPI DECLSPEC_HOTPATCH NeedCurrentDirectoryForExePathA(LPCSTR name)
Definition: file.c:2619
DWORD WINAPI DECLSPEC_HOTPATCH GetTempPathA(DWORD count, LPSTR path)
Definition: file.c:2420
UINT WINAPI DECLSPEC_HOTPATCH GetSystemWow64Directory2W(LPWSTR path, UINT count, WORD machine)
Definition: file.c:2324
BOOL WINAPI DECLSPEC_HOTPATCH UnlockFileEx(HANDLE file, DWORD reserved, DWORD count_low, DWORD count_high, LPOVERLAPPED overlapped)
Definition: file.c:3879
DWORD WINAPI DECLSPEC_HOTPATCH GetFinalPathNameByHandleA(HANDLE file, LPSTR path, DWORD count, DWORD flags)
Definition: file.c:1770
HANDLE WINAPI FindFirstFileNameW(const WCHAR *file_name, DWORD flags, DWORD *len, WCHAR *link_name)
Definition: file.c:1380
BOOL WINAPI DECLSPEC_HOTPATCH WriteFileGather(HANDLE file, FILE_SEGMENT_ELEMENT *segments, DWORD count, LPDWORD reserved, LPOVERLAPPED overlapped)
Definition: file.c:3974
UINT WINAPI DECLSPEC_HOTPATCH GetTempFileNameW(LPCWSTR path, LPCWSTR prefix, UINT unique, LPWSTR buffer)
Definition: file.c:2355
BOOL WINAPI CreateHardLinkW(LPCWSTR dest, LPCWSTR source, SECURITY_ATTRIBUTES *sec_attr)
Definition: file.c:931
static DWORD copy_filename(const WCHAR *name, WCHAR *buffer, DWORD len)
Definition: file.c:361
DWORD WINAPI DECLSPEC_HOTPATCH GetLongPathNameW(LPCWSTR shortpath, LPWSTR longpath, DWORD longlen)
Definition: file.c:2014
static WCHAR * fixup_mask(const WCHAR *mask)
Definition: file.c:1154
DWORD WINAPI DECLSPEC_HOTPATCH GetTempPathW(DWORD count, LPWSTR path)
Definition: file.c:2438
BOOL WINAPI DECLSPEC_HOTPATCH WriteFile(HANDLE file, LPCVOID buffer, DWORD count, LPDWORD result, LPOVERLAPPED overlapped)
Definition: file.c:3896
WCHAR * file_name_AtoW(LPCSTR name, BOOL alloc)
Definition: file.c:411
BOOL WINAPI FindNextStreamW(HANDLE handle, void *data)
Definition: file.c:1514
BOOL WINAPI DECLSPEC_HOTPATCH UnlockFile(HANDLE file, DWORD offset_low, DWORD offset_high, DWORD count_low, DWORD count_high)
Definition: file.c:3863
BOOL WINAPI DECLSPEC_HOTPATCH GetCommModemStatus(HANDLE handle, DWORD *status)
Definition: file.c:4346
void WINAPI DECLSPEC_HOTPATCH SetFileApisToOEM(void)
Definition: file.c:2897
BOOL WINAPI DECLSPEC_HOTPATCH FlushFileBuffers(HANDLE file)
Definition: file.c:3027
BOOL WINAPI DECLSPEC_HOTPATCH FileTimeToLocalFileTime(const FILETIME *utc, FILETIME *local)
Definition: file.c:4017
DWORD WINAPI DECLSPEC_HOTPATCH GetTempPath2A(DWORD count, LPSTR path)
Definition: file.c:2491
UINT WINAPI DECLSPEC_HOTPATCH GetCurrentDirectoryA(UINT buflen, LPSTR buf)
Definition: file.c:1620
DWORD WINAPI DECLSPEC_HOTPATCH GetFileType(HANDLE file)
Definition: file.c:3221
HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstChangeNotificationA(LPCSTR path, BOOL subtree, DWORD filter)
Definition: file.c:1048
BOOL WINAPI DECLSPEC_HOTPATCH SetFileAttributesA(LPCSTR name, DWORD attributes)
Definition: file.c:2906
BOOL WINAPI DECLSPEC_HOTPATCH FileTimeToSystemTime(const FILETIME *ft, SYSTEMTIME *systime)
Definition: file.c:4026
BOOL WINAPI DECLSPEC_HOTPATCH GetOverlappedResult(HANDLE file, LPOVERLAPPED overlapped, LPDWORD result, BOOL wait)
Definition: file.c:3255
static BOOL copy_file(const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDED_PARAMETERS *params)
Definition: file.c:491
UINT WINAPI DECLSPEC_HOTPATCH GetWindowsDirectoryA(LPSTR path, UINT count)
Definition: file.c:2513
static void WINAPI invoke_completion(void *context, IO_STATUS_BLOCK *io, ULONG res)
Definition: file.c:3440
BOOL WINAPI DECLSPEC_HOTPATCH SetCommState(HANDLE handle, DCB *dcb)
Definition: file.c:4483
BOOL WINAPI DECLSPEC_HOTPATCH GetCommProperties(HANDLE handle, COMMPROP *prop)
Definition: file.c:4356
BOOL WINAPI DECLSPEC_HOTPATCH GetFileInformationByHandle(HANDLE file, BY_HANDLE_FILE_INFORMATION *info)
Definition: file.c:3038
const WCHAR system_dir[]
Definition: file.c:68
HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExA(const char *filename, FINDEX_INFO_LEVELS level, void *data, FINDEX_SEARCH_OPS search_op, void *filter, DWORD flags)
Definition: file.c:1122
BOOL WINAPI DECLSPEC_HOTPATCH LocalFileTimeToFileTime(const FILETIME *local, FILETIME *utc)
Definition: file.c:4116
DWORD WINAPI DECLSPEC_HOTPATCH SearchPathA(LPCSTR path, LPCSTR name, LPCSTR ext, DWORD buflen, LPSTR buffer, LPSTR *lastpart)
Definition: file.c:2749
HRESULT WINAPI CopyFile2(const WCHAR *source, const WCHAR *dest, COPYFILE2_EXTENDED_PARAMETERS *params)
Definition: file.c:600
void WINAPI DECLSPEC_HOTPATCH SetFileApisToANSI(void)
Definition: file.c:2888
BOOL WINAPI DECLSPEC_HOTPATCH DeleteFileW(LPCWSTR path)
Definition: file.c:1003
static const UINT max_entry_size
Definition: file.c:65
BOOL WINAPI DECLSPEC_HOTPATCH GetCommMask(HANDLE handle, DWORD *mask)
Definition: file.c:4336
BOOL WINAPI DECLSPEC_HOTPATCH SetFileInformationByHandle(HANDLE file, FILE_INFO_BY_HANDLE_CLASS class, void *info, DWORD size)
Definition: file.c:3670
BOOL WINAPI DECLSPEC_HOTPATCH DeleteFileA(LPCSTR path)
Definition: file.c:991
BOOL WINAPI DECLSPEC_HOTPATCH GetSystemTimeAdjustment(DWORD *adjust, DWORD *increment, BOOL *disabled)
Definition: file.c:4077
BOOL WINAPI DECLSPEC_HOTPATCH SetCommBreak(HANDLE handle)
Definition: file.c:4454
UINT WINAPI GetSystemWow64DirectoryW(LPWSTR path, UINT count)
Definition: file.c:2299
HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileW(const WCHAR *filename, WIN32_FIND_DATAW *data)
Definition: file.c:1372
DWORD WINAPI DECLSPEC_HOTPATCH GetFileSize(HANDLE file, LPDWORD size_high)
Definition: file.c:3160
DWORD WINAPI DECLSPEC_HOTPATCH GetFullPathNameA(LPCSTR name, DWORD len, LPSTR buffer, LPSTR *lastpart)
Definition: file.c:1949
static NTSTATUS find_actctx_dllpath(const WCHAR *name, WCHAR **path)
Definition: file.c:269
UINT WINAPI DECLSPEC_HOTPATCH GetSystemWow64Directory2A(LPSTR path, UINT count, WORD machine)
Definition: file.c:2313
static BOOL contains_path(const WCHAR *name)
Definition: file.c:102
BOOL WINAPI DECLSPEC_HOTPATCH PurgeComm(HANDLE handle, DWORD flags)
Definition: file.c:4444
BOOL WINAPI DECLSPEC_HOTPATCH CreateDirectoryExW(LPCWSTR template, LPCWSTR path, LPSECURITY_ATTRIBUTES sa)
Definition: file.c:688
static WCHAR * append_ext(const WCHAR *name, const WCHAR *ext)
Definition: file.c:243
HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileById(HANDLE handle, LPFILE_ID_DESCRIPTOR id, DWORD access, DWORD share, LPSECURITY_ATTRIBUTES sec_attr, DWORD flags)
Definition: file.c:3356
BOOL WINAPI DECLSPEC_HOTPATCH WriteFileEx(HANDLE file, LPCVOID buffer, DWORD count, LPOVERLAPPED overlapped, LPOVERLAPPED_COMPLETION_ROUTINE completion)
Definition: file.c:3943
BOOL WINAPI DECLSPEC_HOTPATCH GetFileAttributesExA(LPCSTR name, GET_FILEEX_INFO_LEVELS level, void *ptr)
Definition: file.c:1709
UINT WINAPI DECLSPEC_HOTPATCH GetSystemWindowsDirectoryA(LPSTR path, UINT count)
Definition: file.c:2267
UINT WINAPI DECLSPEC_HOTPATCH GetTempFileNameA(LPCSTR path, LPCSTR prefix, UINT unique, LPSTR buffer)
Definition: file.c:2335
BOOL WINAPI DECLSPEC_HOTPATCH ClearCommError(HANDLE handle, DWORD *errors, COMSTAT *stat)
Definition: file.c:4208
DWORD WINAPI kernelbase_Wow64EnableWow64FsRedirection(BOOLEAN enable)
Definition: file.c:2971
BOOL WINAPI DECLSPEC_HOTPATCH SetupComm(HANDLE handle, DWORD in_size, DWORD out_size)
Definition: file.c:4568
BOOL WINAPI DECLSPEC_HOTPATCH EscapeCommFunction(HANDLE handle, DWORD func)
Definition: file.c:4283
BOOL WINAPI DECLSPEC_HOTPATCH RemoveDirectoryA(LPCSTR path)
Definition: file.c:3607
static void dump_dcb(const DCB *dcb)
Definition: file.c:4186
BOOL WINAPI DECLSPEC_HOTPATCH FindNextFileW(HANDLE handle, WIN32_FIND_DATAW *data)
Definition: file.c:1422
void WINAPI DECLSPEC_HOTPATCH GetLocalTime(SYSTEMTIME *systime)
Definition: file.c:4052
UINT WINAPI DECLSPEC_HOTPATCH GetSystemWindowsDirectoryW(LPWSTR path, UINT count)
Definition: file.c:2276
BOOL WINAPI DECLSPEC_HOTPATCH ReadFileEx(HANDLE file, LPVOID buffer, DWORD count, LPOVERLAPPED overlapped, LPOVERLAPPED_COMPLETION_ROUTINE completion)
Definition: file.c:3553
BOOL WINAPI DECLSPEC_HOTPATCH SetCommConfig(HANDLE handle, COMMCONFIG *config, DWORD size)
Definition: file.c:4463
BOOL WINAPI DECLSPEC_HOTPATCH CopyFileW(const WCHAR *source, const WCHAR *dest, BOOL fail_if_exists)
Definition: file.c:632
#define FIND_FIRST_MAGIC
Definition: file.c:63
DWORD WINAPI DECLSPEC_HOTPATCH GetFileAttributesA(LPCSTR name)
Definition: file.c:1659
static DWORD copy_filename_WtoA(LPCWSTR nameW, LPSTR buffer, DWORD len)
Definition: file.c:378
UINT WINAPI DECLSPEC_HOTPATCH GetWindowsDirectoryW(LPWSTR path, UINT count)
Definition: file.c:2522
BOOL WINAPI DECLSPEC_HOTPATCH GetCommState(HANDLE handle, DCB *dcb)
Definition: file.c:4365
DWORD WINAPI DECLSPEC_HOTPATCH GetShortPathNameW(LPCWSTR longpath, LPWSTR shortpath, DWORD shortlen)
Definition: file.c:2122
BOOL WINAPI DECLSPEC_HOTPATCH Wow64RevertWow64FsRedirection(PVOID old_value)
Definition: file.c:2980
HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileExW(LPCWSTR filename, FINDEX_INFO_LEVELS level, LPVOID data, FINDEX_SEARCH_OPS search_op, LPVOID filter, DWORD flags)
Definition: file.c:1180
HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstFileA(const char *filename, WIN32_FIND_DATAA *data)
Definition: file.c:1363
BOOL WINAPI DECLSPEC_HOTPATCH GetCommTimeouts(HANDLE handle, COMMTIMEOUTS *timeouts)
Definition: file.c:4430
BOOL WINAPI DECLSPEC_HOTPATCH SetCurrentDirectoryA(LPCSTR dir)
Definition: file.c:2862
BOOL WINAPI DECLSPEC_HOTPATCH SetFileAttributesW(LPCWSTR name, DWORD attributes)
Definition: file.c:2918
DWORD WINAPI DECLSPEC_HOTPATCH GetTempPath2W(DWORD count, LPWSTR path)
Definition: file.c:2502
HRESULT WINAPI QueryIoRingCapabilities(IORING_CAPABILITIES *caps)
Definition: file.c:4600
BOOL WINAPI DECLSPEC_HOTPATCH ReadDirectoryChangesW(HANDLE handle, LPVOID buffer, DWORD len, BOOL subtree, DWORD filter, LPDWORD returned, LPOVERLAPPED overlapped, LPOVERLAPPED_COMPLETION_ROUTINE completion)
Definition: file.c:3449
HANDLE WINAPI FindFirstStreamW(const WCHAR *filename, STREAM_INFO_LEVELS level, void *data, DWORD flags)
Definition: file.c:1390
DWORD WINAPI DECLSPEC_HOTPATCH GetCompressedFileSizeA(LPCSTR name, LPDWORD size_high)
Definition: file.c:1570
BOOL WINAPI DECLSPEC_HOTPATCH CreateHardLinkA(const char *dest, const char *source, SECURITY_ATTRIBUTES *attr)
Definition: file.c:909
DWORD WINAPI DECLSPEC_HOTPATCH GetCompressedFileSizeW(LPCWSTR name, LPDWORD size_high)
Definition: file.c:1582
BOOL WINAPI DECLSPEC_HOTPATCH GetFileInformationByHandleEx(HANDLE handle, FILE_INFO_BY_HANDLE_CLASS class, LPVOID info, DWORD size)
Definition: file.c:3073
BOOL WINAPI DECLSPEC_HOTPATCH SetSystemTime(const SYSTEMTIME *systime)
Definition: file.c:4139
BOOLEAN WINAPI CreateSymbolicLinkW(LPCWSTR link, LPCWSTR target, DWORD flags)
Definition: file.c:981
BOOL WINAPI DECLSPEC_HOTPATCH GetOverlappedResultEx(HANDLE file, OVERLAPPED *overlapped, DWORD *result, DWORD timeout, BOOL alertable)
Definition: file.c:3265
DWORD WINAPI DECLSPEC_HOTPATCH GetLongPathNameA(LPCSTR shortpath, LPSTR longpath, DWORD longlen)
Definition: file.c:1989
UINT WINAPI DECLSPEC_HOTPATCH GetSystemDirectoryW(LPWSTR path, UINT count)
Definition: file.c:2258
BOOL WINAPI DECLSPEC_HOTPATCH CreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sa)
Definition: file.c:653
BOOL WINAPI DECLSPEC_HOTPATCH NeedCurrentDirectoryForExePathW(LPCWSTR name)
Definition: file.c:2631
BOOL WINAPI DECLSPEC_HOTPATCH SetSystemTimeAdjustment(DWORD adjust, BOOL disabled)
Definition: file.c:4151
BOOL WINAPI CopyFileExW(const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUTINE progress, void *param, BOOL *cancel_ptr, DWORD flags)
Definition: file.c:609
DWORD WINAPI DECLSPEC_HOTPATCH SearchPathW(LPCWSTR path, LPCWSTR name, LPCWSTR ext, DWORD buflen, LPWSTR buffer, LPWSTR *lastpart)
Definition: file.c:2790
void WINAPI DECLSPEC_HOTPATCH GetSystemTimePreciseAsFileTime(FILETIME *time)
Definition: file.c:4103
UINT WINAPI GetSystemWow64DirectoryA(LPSTR path, UINT count)
Definition: file.c:2285
BOOL WINAPI DECLSPEC_HOTPATCH SetCurrentDirectoryW(LPCWSTR dir)
Definition: file.c:2876
BOOL WINAPI DECLSPEC_HOTPATCH Wow64DisableWow64FsRedirection(PVOID *old_value)
Definition: file.c:2960
void WINAPI DECLSPEC_HOTPATCH GetSystemTime(SYSTEMTIME *systime)
Definition: file.c:4065
static BOOL oem_file_apis
Definition: file.c:70
BOOL WINAPI DECLSPEC_HOTPATCH CreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sa)
Definition: file.c:641
BOOL WINAPI DECLSPEC_HOTPATCH TransmitCommChar(HANDLE handle, CHAR ch)
Definition: file.c:4581
static IO_STATUS_BLOCK dummy_iosb
Definition: file.c:1062
HANDLE WINAPI DECLSPEC_HOTPATCH CreateFile2(LPCWSTR name, DWORD access, DWORD sharing, DWORD creation, CREATEFILE2_EXTENDED_PARAMETERS *params)
Definition: file.c:698
UINT WINAPI DECLSPEC_HOTPATCH GetSystemDirectoryA(LPSTR path, UINT count)
Definition: file.c:2249
BOOL WINAPI DECLSPEC_HOTPATCH WaitCommEvent(HANDLE handle, DWORD *events, OVERLAPPED *overlapped)
Definition: file.c:4590
BOOL WINAPI DECLSPEC_HOTPATCH FindNextFileA(HANDLE handle, WIN32_FIND_DATAA *data)
Definition: file.c:1401
void WINAPI DECLSPEC_HOTPATCH GetSystemTimeAsFileTime(FILETIME *time)
Definition: file.c:4094
BOOL WINAPI DECLSPEC_HOTPATCH GetFileAttributesExW(LPCWSTR name, GET_FILEEX_INFO_LEVELS level, void *ptr)
Definition: file.c:1721
BOOL WINAPI DECLSPEC_HOTPATCH GetFileTime(HANDLE file, FILETIME *creation, FILETIME *access, FILETIME *write)
Definition: file.c:3190
BOOL WINAPI DECLSPEC_HOTPATCH RemoveDirectoryW(LPCWSTR path)
Definition: file.c:3619
BOOL WINAPI DECLSPEC_HOTPATCH SetCommTimeouts(HANDLE handle, COMMTIMEOUTS *timeouts)
Definition: file.c:4553
BOOL WINAPI DECLSPEC_HOTPATCH LockFile(HANDLE file, DWORD offset_low, DWORD offset_high, DWORD count_low, DWORD count_high)
Definition: file.c:3306
BOOL WINAPI DECLSPEC_HOTPATCH FindClose(HANDLE handle)
Definition: file.c:1525
HANDLE WINAPI DECLSPEC_HOTPATCH FindFirstChangeNotificationW(LPCWSTR path, BOOL subtree, DWORD filter)
Definition: file.c:1067
BOOL WINAPI DECLSPEC_HOTPATCH SetCommMask(HANDLE handle, DWORD mask)
Definition: file.c:4473
BOOL WINAPI DECLSPEC_HOTPATCH LockFileEx(HANDLE file, DWORD flags, DWORD reserved, DWORD count_low, DWORD count_high, LPOVERLAPPED overlapped)
Definition: file.c:3324
BOOL WINAPI DECLSPEC_HOTPATCH CancelIoEx(HANDLE handle, LPOVERLAPPED overlapped)
Definition: file.c:3005
BOOL WINAPI DECLSPEC_HOTPATCH SystemTimeToFileTime(const SYSTEMTIME *systime, FILETIME *ft)
Definition: file.c:4164
static UINT get_nt_file_options(DWORD attributes)
Definition: file.c:752
const WCHAR windows_dir[]
Definition: file.c:67
BOOL WINAPI DECLSPEC_HOTPATCH ReadFileScatter(HANDLE file, FILE_SEGMENT_ELEMENT *segments, DWORD count, LPDWORD reserved, LPOVERLAPPED overlapped)
Definition: file.c:3583
BOOL WINAPI DECLSPEC_HOTPATCH SetLocalTime(const SYSTEMTIME *systime)
Definition: file.c:4125
BOOL WINAPI DECLSPEC_HOTPATCH FindCloseChangeNotification(HANDLE handle)
Definition: file.c:1039
BOOL WINAPI DECLSPEC_HOTPATCH GetCommConfig(HANDLE handle, COMMCONFIG *config, DWORD *size)
Definition: file.c:4311
BOOL WINAPI DECLSPEC_HOTPATCH ReplaceFileW(const WCHAR *replaced, const WCHAR *replacement, const WCHAR *backup, DWORD flags, void *exclude, void *reserved)
Definition: file.c:2644
HANDLE WINAPI DECLSPEC_HOTPATCH ReOpenFile(HANDLE handle, DWORD access, DWORD sharing, DWORD attributes)
Definition: file.c:3402
static BOOL is_same_file(HANDLE h1, HANDLE h2)
Definition: file.c:469
INT WINAPI DECLSPEC_HOTPATCH CompareFileTime(const FILETIME *x, const FILETIME *y)
Definition: file.c:4003
BOOL WINAPI DECLSPEC_HOTPATCH SetEndOfFile(HANDLE file)
Definition: file.c:3651
BOOL WINAPI DECLSPEC_HOTPATCH SetFileTime(HANDLE file, const FILETIME *ctime, const FILETIME *atime, const FILETIME *mtime)
Definition: file.c:3819
static void WINAPI read_write_apc(void *apc_user, PIO_STATUS_BLOCK io, ULONG reserved)
Definition: file.c:73
BOOL WINAPI DECLSPEC_HOTPATCH ClearCommBreak(HANDLE handle)
Definition: file.c:4199
DWORD WINAPI DECLSPEC_HOTPATCH GetFullPathNameW(LPCWSTR name, DWORD len, LPWSTR buffer, LPWSTR *lastpart)
Definition: file.c:1980
BOOL WINAPI DECLSPEC_HOTPATCH AreFileApisANSI(void)
Definition: file.c:483
BOOL WINAPI DECLSPEC_HOTPATCH SetFilePointerEx(HANDLE file, LARGE_INTEGER distance, LARGE_INTEGER *newpos, DWORD method)
Definition: file.c:3770
BOOL WINAPI DECLSPEC_HOTPATCH CancelIo(HANDLE handle)
Definition: file.c:2994
BOOL WINAPI DECLSPEC_HOTPATCH SetFileValidData(HANDLE file, LONGLONG length)
Definition: file.c:3849
BOOL WINAPI DECLSPEC_HOTPATCH MoveFileWithProgressW(const WCHAR *source, const WCHAR *dest, LPPROGRESS_ROUTINE progress, void *param, DWORD flag)
Definition: file.c:2540
BOOL WINAPI DECLSPEC_HOTPATCH FindNextChangeNotification(HANDLE handle)
Definition: file.c:1110
DWORD file_name_WtoA(LPCWSTR src, INT srclen, LPSTR dest, INT destlen)
Definition: file.c:438
DWORD WINAPI DECLSPEC_HOTPATCH GetFinalPathNameByHandleW(HANDLE file, LPWSTR path, DWORD count, DWORD flags)
Definition: file.c:1810
BOOL WINAPI DECLSPEC_HOTPATCH CancelSynchronousIo(HANDLE thread)
Definition: file.c:3016
DWORD WINAPI DECLSPEC_HOTPATCH GetFileAttributesW(LPCWSTR name)
Definition: file.c:1671
BOOL WINAPI MoveFileExW(const WCHAR *source, const WCHAR *dest, DWORD flag)
Definition: file.c:2531
static BOOL add_boot_rename_entry(LPCWSTR source, LPCWSTR dest, DWORD flags)
Definition: file.c:142
INT WINAPI DECLSPEC_HOTPATCH CompareStringOrdinal(const WCHAR *str1, INT len1, const WCHAR *str2, INT len2, BOOL ignore_case)
Definition: locale.c:4886
WCHAR *WINAPI PathFindFileNameW(const WCHAR *path)
Definition: path.c:1701
BOOL WINAPI PathRemoveFileSpecW(WCHAR *path)
Definition: path.c:1145
DWORD WINAPI GetVersion(void)
Definition: version.c:1458
#define swprintf
Definition: precomp.h:40
method
Definition: dragdrop.c:54
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r reserved
Definition: btrfs.c:3006
#define FileStatInformation
Definition: fileinfo.c:28
#define FileIdInformation
Definition: fileinfo.c:24
#define FileDispositionInformationEx
Definition: fileinfo.c:26
#define PST_RS232
Definition: serial.h:17
#define INFINITE
Definition: serial.h:102
BOOLEAN RtlTimeToTimeFields(IN PLARGE_INTEGER Time, IN PTIME_FIELDS TimeFields)
BOOLEAN RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields, IN PLARGE_INTEGER Time)
struct _IO_STATUS_BLOCK * PIO_STATUS_BLOCK
Definition: change.c:34
#define MOVEFILE_REPLACE_EXISTING
Definition: filesup.h:28
#define MOVEFILE_COPY_ALLOWED
Definition: filesup.h:29
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
@ SystemTimeAdjustmentInformation
Definition: ntddk_ex.h:39
unsigned short WORD
Definition: ntddk_ex.h:93
#define local
Definition: zutil.h:30
#define FILE_OPEN_BY_FILE_ID
Definition: from_kernel.h:41
@ FilePositionInformation
Definition: from_kernel.h:75
@ FileEndOfFileInformation
Definition: from_kernel.h:81
@ FileCompressionInformation
Definition: from_kernel.h:89
@ FileRenameInformation
Definition: from_kernel.h:71
@ FileIoPriorityHintInformation
Definition: from_kernel.h:104
@ FileLinkInformation
Definition: from_kernel.h:72
@ FileAttributeTagInformation
Definition: from_kernel.h:96
@ FileAlignmentInformation
Definition: from_kernel.h:78
@ FileIdBothDirectoryInformation
Definition: from_kernel.h:98
@ FileValidDataLengthInformation
Definition: from_kernel.h:100
@ FileNameInformation
Definition: from_kernel.h:70
@ FileFullDirectoryInformation
Definition: from_kernel.h:63
@ FileStreamInformation
Definition: from_kernel.h:83
@ FileBasicInformation
Definition: from_kernel.h:65
@ FileDispositionInformation
Definition: from_kernel.h:74
@ FileBothDirectoryInformation
Definition: from_kernel.h:64
#define FILE_OPEN
Definition: from_kernel.h:54
#define FILE_CREATE
Definition: from_kernel.h:55
#define FILE_OVERWRITE_IF
Definition: from_kernel.h:58
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
@ FileFsDeviceInformation
Definition: from_kernel.h:222
@ FileFsVolumeInformation
Definition: from_kernel.h:219
#define FILE_NO_INTERMEDIATE_BUFFERING
Definition: from_kernel.h:28
#define FILE_RANDOM_ACCESS
Definition: from_kernel.h:38
#define FILE_OVERWRITE
Definition: from_kernel.h:57
#define FILE_WRITE_THROUGH
Definition: from_kernel.h:26
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define FILE_SEQUENTIAL_ONLY
Definition: from_kernel.h:27
#define FILE_OPEN_FOR_BACKUP_INTENT
Definition: from_kernel.h:42
LARGE_INTEGER li
Definition: fxtimerapi.cpp:235
GLint level
Definition: gl.h:1546
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble t
Definition: gl.h:2047
GLenum func
Definition: glext.h:6028
struct _cl_event * event
Definition: glext.h:7739
GLuint res
Definition: glext.h:9613
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLenum GLint GLuint mask
Definition: glext.h:6028
GLsizei GLsizei GLfloat distance
Definition: glext.h:11755
GLenum const GLfloat * params
Definition: glext.h:5645
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
GLbitfield flags
Definition: glext.h:7161
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
GLuint64EXT * result
Definition: glext.h:11304
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean enable
Definition: glext.h:11120
GLuint GLuint num
Definition: glext.h:9618
GLfloat param
Definition: glext.h:5796
GLenum GLsizei len
Definition: glext.h:6722
GLuint id
Definition: glext.h:5910
GLenum target
Definition: glext.h:7315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ss
Definition: i386-dis.c:441
HFONT tf
Definition: icontest.c:17
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define OBJ_INHERIT
Definition: winternl.h:225
BOOLEAN NTAPI RtlIsNameLegalDOS8Dot3(_In_ PUNICODE_STRING Name, _Inout_opt_ POEM_STRING OemName, _Inout_opt_ PBOOLEAN NameContainsSpaces)
NTSTATUS NTAPI RtlLocalTimeToSystemTime(IN PLARGE_INTEGER LocalTime, _Out_ PLARGE_INTEGER SystemTime)
NTSYSAPI NTSTATUS WINAPI RtlFindActivationContextSectionString(ULONG, const GUID *, ULONG, const UNICODE_STRING *, PVOID)
Definition: actctx.c:5874
NTSYSAPI void WINAPI RtlReleaseActivationContext(HANDLE)
Definition: actctx.c:5384
NTSYSAPI NTSTATUS WINAPI RtlInitializeCriticalSectionEx(RTL_CRITICAL_SECTION *, ULONG, ULONG)
NTSYSAPI NTSTATUS WINAPI NtCancelIoFileEx(HANDLE, PIO_STATUS_BLOCK, PIO_STATUS_BLOCK)
@ RELATIVE_PATH
Definition: winternl.h:1113
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
NTSYSAPI NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(PCWSTR, PUNICODE_STRING, PWSTR *, CURDIR *)
NTSYSAPI NTSTATUS WINAPI RtlQueryInformationActivationContext(ULONG, HANDLE, PVOID, ULONG, PVOID, SIZE_T, SIZE_T *)
Definition: actctx.c:5572
#define S_OK
Definition: intsafe.h:52
const char * filename
Definition: ioapi.h:137
NTSTATUS NTAPI NtReadFileScatter(IN HANDLE FileHandle, IN HANDLE Event OPTIONAL, IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, IN PVOID UserApcContext OPTIONAL, OUT PIO_STATUS_BLOCK UserIoStatusBlock, IN FILE_SEGMENT_ELEMENT BufferDescription[], IN ULONG BufferLength, IN PLARGE_INTEGER ByteOffset, IN PULONG Key OPTIONAL)
Definition: iofunc.c:3063
NTSTATUS NTAPI NtFlushBuffersFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: iofunc.c:1487
NTSTATUS NTAPI NtLockFile(IN HANDLE FileHandle, IN HANDLE EventHandle OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PVOID ApcContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER ByteOffset, IN PLARGE_INTEGER Length, IN ULONG Key, IN BOOLEAN FailImmediately, IN BOOLEAN ExclusiveLock)
Definition: iofunc.c:1764
NTSTATUS NTAPI NtNotifyChangeDirectoryFile(IN HANDLE FileHandle, IN HANDLE EventHandle OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PVOID ApcContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID Buffer, IN ULONG BufferSize, IN ULONG CompletionFilter, IN BOOLEAN WatchTree)
Definition: iofunc.c:1622
NTSTATUS NTAPI NtQueryDirectoryFile(IN HANDLE FileHandle, IN HANDLE EventHandle OPTIONAL, IN PIO_APC_ROUTINE ApcRoutine OPTIONAL, IN PVOID ApcContext OPTIONAL, OUT PIO_STATUS_BLOCK IoStatusBlock, OUT PVOID FileInformation, IN ULONG Length, IN FILE_INFORMATION_CLASS FileInformationClass, IN BOOLEAN ReturnSingleEntry, IN PUNICODE_STRING FileName OPTIONAL, IN BOOLEAN RestartScan)
Definition: iofunc.c:1994
NTSTATUS NTAPI NtWriteFileGather(IN HANDLE FileHandle, IN HANDLE Event OPTIONAL, IN PIO_APC_ROUTINE UserApcRoutine OPTIONAL, IN PVOID UserApcContext OPTIONAL, OUT PIO_STATUS_BLOCK UserIoStatusBlock, IN FILE_SEGMENT_ELEMENT BufferDescription[], IN ULONG BufferLength, IN PLARGE_INTEGER ByteOffset, IN PULONG Key OPTIONAL)
Definition: iofunc.c:4132
NTSTATUS NTAPI NtUnlockFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER ByteOffset, IN PLARGE_INTEGER Length, IN ULONG Key OPTIONAL)
Definition: iofunc.c:3551
#define NtCurrentTeb
static const WCHAR sourceW[]
Definition: jsregexp.c:37
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_wn
Definition: kernel32.h:33
#define debugstr_w
Definition: kernel32.h:32
BOOL is_wow64
Definition: main.c:38
static const BOOL is_win64
Definition: kernelbase.h:49
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
__u16 ctime
Definition: mkdosfs.c:4
__u16 time
Definition: mkdosfs.c:8
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL WINAPI GetVolumeNameForVolumeMountPointW(IN LPCWSTR VolumeMountPoint, OUT LPWSTR VolumeName, IN DWORD VolumeNameLength)
Definition: mntpoint.c:496
#define FILE_FLAG_OPEN_REPARSE_POINT
Definition: disk.h:39
#define CREATE_ALWAYS
Definition: disk.h:72
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
#define TRUNCATE_EXISTING
Definition: disk.h:71
#define FILE_FLAG_OVERLAPPED
Definition: disk.h:46
#define FILE_FLAG_NO_BUFFERING
Definition: disk.h:45
#define FILE_FLAG_POSIX_SEMANTICS
Definition: disk.h:40
#define FILE_FLAG_BACKUP_SEMANTICS
Definition: disk.h:41
#define FILE_FLAG_OPEN_NO_RECALL
Definition: disk.h:38
#define FILE_FLAG_RANDOM_ACCESS
Definition: disk.h:44
#define FILE_FLAG_DELETE_ON_CLOSE
Definition: disk.h:42
#define CREATE_NEW
Definition: disk.h:69
#define OPEN_ALWAYS
Definition: disk.h:70
#define FILE_FLAG_SEQUENTIAL_SCAN
Definition: disk.h:43
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_FLAG_WRITE_THROUGH
Definition: disk.h:47
#define SERIAL_DSR_SENSITIVITY
Definition: serial.c:128
#define FILE_DEVICE_SERIAL_PORT
Definition: serial.c:44
#define SERIAL_ERROR_ABORT
Definition: serial.c:124
#define SERIAL_CTS_HANDSHAKE
Definition: serial.c:123
#define SERIAL_DTR_CONTROL
Definition: serial.c:122
static PVOID ptr
Definition: dispmode.c:27
#define FILE_NAME_OPENED
#define VOLUME_NAME_GUID
#define VOLUME_NAME_NONE
#define VOLUME_NAME_NT
#define VOLUME_NAME_DOS
HANDLE events[2]
Definition: event.c:4
static char shortpath[MAX_PATH]
Definition: batch.c:32
static UINT UINT last
Definition: font.c:45
static HANDLE PIO_APC_ROUTINE void PIO_STATUS_BLOCK io_status
Definition: comm.c:56
static HANDLE PIO_APC_ROUTINE void * apc_user
Definition: comm.c:55
static LPFILE_ID_DESCRIPTOR
Definition: file.c:37
static FILE_INFO_BY_HANDLE_CLASS
Definition: file.c:36
static const char machine[]
Definition: profile.c:104
static const char session_manager[]
Definition: install.c:5160
static const WCHAR sp[]
Definition: suminfo.c:287
static ULONG * old_value
Definition: directory.c:54
static DWORD LPDWORD LPCSTR DWORD srclen
Definition: directory.c:52
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
Definition: file.c:100
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK io
Definition: file.c:100
static PIO_STATUS_BLOCK iosb
Definition: file.c:98
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG in_size
Definition: file.c:100
static ULONG POBJECT_ATTRIBUTES PIO_STATUS_BLOCK ULONG sharing
Definition: pipe.c:70
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
static char * dest
Definition: rtl.c:135
static LPCWSTR file_name
Definition: protocol.c:147
WCHAR strW[12]
Definition: clipboard.c:2029
static UINT UINT * out_count
Definition: clipboard.c:35
#define min(a, b)
Definition: monoChain.cc:55
char temp_path[MAX_PATH]
Definition: mspatcha.c:123
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned int UINT
Definition: ndis.h:50
NTSYSAPI NTSTATUS NTAPI RtlDeleteCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToOemString(POEM_STRING DestinationString, PCUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI ULONG NTAPI RtlIsDosDeviceName_U(_In_ PCWSTR Name)
NTSYSAPI RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_U(_In_ PCWSTR Path)
NTSYSAPI NTSTATUS NTAPI RtlOemStringToUnicodeString(PUNICODE_STRING DestinationString, PCOEM_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI NTSTATUS NTAPI RtlSetCurrentDirectory_U(_In_ PUNICODE_STRING name)
NTSYSAPI NTSTATUS NTAPI RtlEnterCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI NTSTATUS NTAPI RtlSystemTimeToLocalTime(_In_ PLARGE_INTEGER SystemTime, _Out_ PLARGE_INTEGER LocalTime)
NTSYSAPI NTSTATUS NTAPI RtlLeaveCriticalSection(_In_ PRTL_CRITICAL_SECTION CriticalSection)
NTSYSAPI ULONG NTAPI RtlGetFullPathName_U(_In_ PCWSTR FileName, _In_ ULONG Size, _Out_z_bytecap_(Size) PWSTR Buffer, _Out_opt_ PWSTR *ShortName)
Definition: path.c:1987
NTSYSAPI ULONG NTAPI RtlDosSearchPath_U(_In_ PCWSTR Path, _In_ PCWSTR FileName, _In_ PCWSTR Extension, _In_ ULONG BufferSize, _Out_ PWSTR Buffer, _Out_ PWSTR *PartName)
NTSYSAPI ULONG NTAPI RtlGetCurrentDirectory_U(_In_ ULONG MaximumLength, _Out_bytecap_(MaximumLength) PWSTR Buffer)
Definition: path.c:1661
NTSYSAPI BOOLEAN NTAPI RtlDosPathNameToNtPathName_U(_In_opt_z_ PCWSTR DosPathName, _Out_ PUNICODE_STRING NtPathName, _Out_opt_ PCWSTR *NtFileNamePart, _Out_opt_ PRTL_RELATIVE_NAME_U DirectoryInfo)
NTSYSAPI BOOLEAN NTAPI RtlDoesFileExists_U(_In_ PCWSTR FileName)
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToOemN(_Out_ PCHAR OemString, _In_ ULONG OemSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:263
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteN(_Out_ PCHAR MbString, _In_ ULONG MbSize, _Out_opt_ PULONG ResultSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:107
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3953
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI NTSTATUS NTAPI NtSetValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex OPTIONAL, IN ULONG Type, IN PVOID Data, IN ULONG DataSize)
Definition: ntapi.c:859
#define FILE_ATTRIBUTE_VALID_FLAGS
Definition: nt_native.h:714
#define WRITE_DAC
Definition: nt_native.h:59
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
@ KeyValuePartialInformation
Definition: nt_native.h:1182
NTSYSAPI NTSTATUS NTAPI NtWriteFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID WriteBuffer, IN ULONG WriteBufferLength, IN PLARGE_INTEGER FileOffset OPTIONAL, IN PULONG LockOperationKey OPTIONAL)
#define KEY_ALL_ACCESS
Definition: nt_native.h:1041
#define FILE_READ_ATTRIBUTES
Definition: nt_native.h:647
#define FILE_LIST_DIRECTORY
Definition: nt_native.h:629
#define FILE_ATTRIBUTE_HIDDEN
Definition: nt_native.h:703
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define FILE_ATTRIBUTE_SYSTEM
Definition: nt_native.h:704
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI NTSTATUS NTAPI NtSetInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
Definition: iofunc.c:3096
NTSYSAPI NTSTATUS NTAPI NtQueryValueKey(IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, IN PVOID KeyValueInformation, IN ULONG Length, IN PULONG ResultLength)
NTSYSAPI NTSTATUS NTAPI NtQueryInformationFile(IN HANDLE hFile, OUT PIO_STATUS_BLOCK pIoStatusBlock, OUT PVOID FileInformationBuffer, IN ULONG FileInformationBufferLength, IN FILE_INFORMATION_CLASS FileInfoClass)
#define FILE_ATTRIBUTE_OFFLINE
Definition: nt_native.h:712
#define FILE_OVERWRITTEN
Definition: nt_native.h:771
struct _OBJECT_NAME_INFORMATION OBJECT_NAME_INFORMATION
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
#define REG_MULTI_SZ
Definition: nt_native.h:1501
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define DELETE
Definition: nt_native.h:57
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define FILE_OPENED
Definition: nt_native.h:769
#define DWORD
Definition: nt_native.h:44
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define GENERIC_WRITE
Definition: nt_native.h:90
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
NTSYSAPI NTSTATUS NTAPI NtFsControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define GENERIC_EXECUTE
Definition: nt_native.h:91
#define FILE_ATTRIBUTE_TEMPORARY
Definition: nt_native.h:708
NTSTATUS NTAPI NtCreateKey(OUT PHANDLE KeyHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class OPTIONAL, IN ULONG CreateOptions, OUT PULONG Disposition OPTIONAL)
Definition: ntapi.c:240
#define UNICODE_STRING_MAX_CHARS
#define IOCTL_SERIAL_SET_CHARS
Definition: ntddser.h:88
#define IOCTL_SERIAL_SET_LINE_CONTROL
Definition: ntddser.h:96
#define SERIAL_ERROR_QUEUEOVERRUN
Definition: ntddser.h:401
#define IOCTL_SERIAL_SET_TIMEOUTS
Definition: ntddser.h:104
#define SERIAL_RTS_HANDSHAKE
Definition: ntddser.h:203
#define IOCTL_SERIAL_WAIT_ON_MASK
Definition: ntddser.h:112
#define IOCTL_SERIAL_IMMEDIATE_CHAR
Definition: ntddser.h:74
#define SERIAL_ERROR_CHAR
Definition: ntddser.h:198
#define IOCTL_SERIAL_SET_XOFF
Definition: ntddser.h:108
#define IOCTL_SERIAL_GET_CHARS
Definition: ntddser.h:52
#define SERIAL_DSR_HANDSHAKE
Definition: ntddser.h:190
#define SERIAL_TX_WAITING_FOR_CTS
Definition: ntddser.h:419
#define SERIAL_DTR_HANDSHAKE
Definition: ntddser.h:188
#define SERIAL_TX_WAITING_FOR_XON
Definition: ntddser.h:422
#define IOCTL_SERIAL_SET_WAIT_MASK
Definition: ntddser.h:106
#define IOCTL_SERIAL_SET_QUEUE_SIZE
Definition: ntddser.h:100
#define SERIAL_ERROR_BREAK
Definition: ntddser.h:398
#define IOCTL_SERIAL_RESET_DEVICE
Definition: ntddser.h:80
#define IOCTL_SERIAL_GET_BAUD_RATE
Definition: ntddser.h:50
#define IOCTL_SERIAL_GET_COMMSTATUS
Definition: ntddser.h:54
#define SERIAL_TX_WAITING_FOR_DCD
Definition: ntddser.h:421
#define SERIAL_TX_WAITING_FOR_DSR
Definition: ntddser.h:420
#define IOCTL_SERIAL_GET_WAIT_MASK
Definition: ntddser.h:72
#define IOCTL_SERIAL_SET_BREAK_OFF
Definition: ntddser.h:86
#define SERIAL_NULL_STRIPPING
Definition: ntddser.h:199
#define SERIAL_RTS_CONTROL
Definition: ntddser.h:202
#define SERIAL_AUTO_TRANSMIT
Definition: ntddser.h:196
#define IOCTL_SERIAL_GET_TIMEOUTS
Definition: ntddser.h:70
#define IOCTL_SERIAL_SET_XON
Definition: ntddser.h:110
#define IOCTL_SERIAL_CLR_DTR
Definition: ntddser.h:44
#define IOCTL_SERIAL_SET_BAUD_RATE
Definition: ntddser.h:82
#define IOCTL_SERIAL_GET_PROPERTIES
Definition: ntddser.h:66
#define SERIAL_ERROR_FRAMING
Definition: ntddser.h:399
#define SERIAL_ERROR_PARITY
Definition: ntddser.h:402
#define SERIAL_TX_WAITING_XOFF_SENT
Definition: ntddser.h:423
#define IOCTL_SERIAL_CLR_RTS
Definition: ntddser.h:46
#define SERIAL_AUTO_RECEIVE
Definition: ntddser.h:197
#define SERIAL_ERROR_OVERRUN
Definition: ntddser.h:400
#define IOCTL_SERIAL_GET_MODEMSTATUS
Definition: ntddser.h:64
#define SERIAL_XOFF_CONTINUE
Definition: ntddser.h:205
#define IOCTL_SERIAL_GET_LINE_CONTROL
Definition: ntddser.h:60
#define IOCTL_SERIAL_SET_DTR
Definition: ntddser.h:90
#define IOCTL_SERIAL_SET_BREAK_ON
Definition: ntddser.h:84
#define IOCTL_SERIAL_GET_HANDFLOW
Definition: ntddser.h:58
#define IOCTL_SERIAL_SET_RTS
Definition: ntddser.h:102
#define IOCTL_SERIAL_SET_HANDFLOW
Definition: ntddser.h:94
#define IOCTL_SERIAL_PURGE
Definition: ntddser.h:78
#define FILE_ATTRIBUTE_ENCRYPTED
Definition: ntifs_ex.h:385
NTSTATUS NTAPI NtQuerySystemTime(OUT PLARGE_INTEGER SystemTime)
Definition: time.c:569
NTSTATUS NTAPI NtSetSystemTime(IN PLARGE_INTEGER SystemTime, OUT PLARGE_INTEGER PreviousTime OPTIONAL)
Definition: time.c:458
NTSTATUS NTAPI NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_BASIC_INFORMATION FileInformation)
Definition: file.c:3979
NTSTATUS NTAPI NtCancelIoFile(IN HANDLE FileHandle, OUT PIO_STATUS_BLOCK IoStatusBlock)
Definition: file.c:4020
NTSTATUS NTAPI NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation)
Definition: file.c:3991
#define STATUS_SXS_KEY_NOT_FOUND
Definition: ntstatus.h:1389
#define STATUS_NOT_SAME_DEVICE
Definition: ntstatus.h:448
#define LOWORD(l)
Definition: pedump.c:82
#define IMAGE_FILE_MACHINE_I386
Definition: pedump.c:174
long LONG
Definition: pedump.c:60
#define FILE_DEVICE_FILE_SYSTEM
Definition: winioctl.h:54
#define FILE_DEVICE_NAMED_PIPE
Definition: winioctl.h:62
#define FILE_DEVICE_TAPE
Definition: winioctl.h:76
#define FILE_DEVICE_NULL
Definition: winioctl.h:66
#define FILE_DEVICE_UNKNOWN
Definition: winioctl.h:79
#define FILE_DEVICE_CONSOLE
Definition: winioctl.h:117
#define FILE_DEVICE_PARALLEL_PORT
Definition: winioctl.h:67
#define FSCTL_GET_OBJECT_ID
Definition: winioctl.h:130
#define alloc
Definition: rosglue.h:13
const WCHAR * str
#define NtGetTickCount
Definition: rtlp.h:163
#define offsetof(TYPE, MEMBER)
_Check_return_ _CRTIMP int __cdecl __cdecl eof(_In_ int _FileHandle)
_Check_return_ _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(_In_z_ const wchar_t *_Str, _In_z_ const wchar_t *_Control)
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
#define DECLSPEC_HOTPATCH
Definition: config.h:9
#define memset(x, y, z)
Definition: compat.h:39
#define FileStandardInformation
Definition: propsheet.cpp:61
#define STATUS_END_OF_FILE
Definition: shellext.h:67
NTSTATUS NTAPI NtQueryVolumeInformationFile(HANDLE FileHandle, PIO_STATUS_BLOCK IoStatusBlock, PVOID FsInformation, ULONG Length, FS_INFORMATION_CLASS FsInformationClass)
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
NTSTATUS NTAPI NtReadFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, PVOID Buffer, ULONG Length, PLARGE_INTEGER ByteOffset, PULONG Key)
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
Definition: sock.c:81
#define TRACE(s)
Definition: solgame.cpp:4
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
FINDEX_INFO_LEVELS level
Definition: file.c:54
UINT data_len
Definition: file.c:58
DWORD magic
Definition: file.c:50
UINT data_size
Definition: file.c:59
UINT data_pos
Definition: file.c:57
BOOL is_root
Definition: file.c:56
CRITICAL_SECTION cs
Definition: file.c:52
HANDLE handle
Definition: file.c:51
UNICODE_STRING path
Definition: file.c:55
FINDEX_SEARCH_OPS search_op
Definition: file.c:53
Definition: cdstruc.h:902
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
LARGE_INTEGER CreationTime
Definition: from_kernel.h:141
LARGE_INTEGER LastAccessTime
Definition: from_kernel.h:142
LARGE_INTEGER LastWriteTime
Definition: from_kernel.h:143
LARGE_INTEGER LastAccessTime
Definition: fileinfo.c:42
LARGE_INTEGER FileId
Definition: fileinfo.c:40
LARGE_INTEGER EndOfFile
Definition: fileinfo.c:46
LARGE_INTEGER LastWriteTime
Definition: fileinfo.c:43
LARGE_INTEGER CreationTime
Definition: fileinfo.c:41
HANDLE hEvent
Definition: winbase.h:855
LPVOID lpSecurityDescriptor
Definition: compat.h:193
SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
Definition: lsa.idl:66
SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
Definition: lsa.idl:65
UCHAR XoffChar
Definition: ntddser.h:167
UCHAR EventChar
Definition: ntddser.h:165
UCHAR ErrorChar
Definition: ntddser.h:163
UCHAR EofChar
Definition: ntddser.h:162
UCHAR XonChar
Definition: ntddser.h:166
UCHAR BreakChar
Definition: ntddser.h:164
ULONG ControlHandShake
Definition: ntddser.h:180
ULONG FlowReplace
Definition: ntddser.h:181
WORD wYear
Definition: winbase.h:946
WORD wMilliseconds
Definition: winbase.h:953
WORD wMonth
Definition: winbase.h:947
WORD wHour
Definition: winbase.h:950
WORD wSecond
Definition: winbase.h:952
WORD wMinute
Definition: winbase.h:951
WORD wDay
Definition: winbase.h:949
WORD wDayOfWeek
Definition: winbase.h:948
BOOLEAN TimeAdjustmentDisabled
Definition: winternl.h:1660
Definition: cookie.c:202
Definition: inflate.c:139
Definition: http.c:7252
Definition: devices.h:37
Definition: fci.c:127
Definition: copy.c:22
Definition: name.c:39
Definition: stat.h:55
Definition: ps.c:97
Definition: fci.c:110
Definition: dhcpd.h:245
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
Definition: synch.c:94
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
Character const *const prefix
Definition: tempnam.cpp:195
#define DWORD_PTR
Definition: treelist.c:76
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int64_t LONGLONG
Definition: typedefs.h:68
PVOID HANDLE
Definition: typedefs.h:73
ULONG_PTR SIZE_T
Definition: typedefs.h:80
uint32_t * LPDWORD
Definition: typedefs.h:59
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define HIWORD(l)
Definition: typedefs.h:247
#define STATUS_OBJECT_NAME_COLLISION
Definition: udferr_usr.h:150
#define STATUS_OBJECT_NAME_NOT_FOUND
Definition: udferr_usr.h:149
#define STATUS_NO_MORE_FILES
Definition: udferr_usr.h:128
#define NT_ERROR(Status)
Definition: umtypes.h:106
LONGLONG QuadPart
Definition: typedefs.h:114
struct _LARGE_INTEGER::@2473 u
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define CE_BREAK
Definition: winbase.h:143
#define COPY_FILE_FAIL_IF_EXISTS
Definition: winbase.h:238
struct _COMM_CONFIG COMMCONFIG
void(CALLBACK * LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD, DWORD, LPOVERLAPPED)
Definition: winbase.h:1492
enum _FINDEX_SEARCH_OPS FINDEX_SEARCH_OPS
#define LOCKFILE_FAIL_IMMEDIATELY
Definition: winbase.h:418
#define STD_OUTPUT_HANDLE
Definition: winbase.h:301
#define FILE_END
Definition: winbase.h:122
#define STD_INPUT_HANDLE
Definition: winbase.h:300
#define COPY_FILE_RESTARTABLE
Definition: winbase.h:239
#define RTS_CONTROL_ENABLE
Definition: winbase.h:573
#define DTR_CONTROL_HANDSHAKE
Definition: winbase.h:571
#define CE_OVERRUN
Definition: winbase.h:149
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define TWOSTOPBITS
Definition: winbase.h:493
#define LOCKFILE_EXCLUSIVE_LOCK
Definition: winbase.h:419
@ FindExSearchLimitToDirectories
Definition: winbase.h:1176
@ FindExSearchNameMatch
Definition: winbase.h:1175
#define COPY_FILE_OPEN_SOURCE_FOR_WRITE
Definition: winbase.h:240
#define FILE_TYPE_UNKNOWN
Definition: winbase.h:291
#define ONESTOPBIT
Definition: winbase.h:491
#define RTS_CONTROL_HANDSHAKE
Definition: winbase.h:574
#define FIND_FIRST_EX_LARGE_FETCH
Definition: winbase.h:268
#define DTR_CONTROL_DISABLE
Definition: winbase.h:569
#define RTS_CONTROL_TOGGLE
Definition: winbase.h:575
#define CE_RXPARITY
Definition: winbase.h:152
DWORD(WINAPI * LPPROGRESS_ROUTINE)(_In_ LARGE_INTEGER, _In_ LARGE_INTEGER, _In_ LARGE_INTEGER, _In_ LARGE_INTEGER, _In_ DWORD, _In_ DWORD, _In_ HANDLE, _In_ HANDLE, _In_opt_ LPVOID)
Definition: winbase.h:1480
#define STD_ERROR_HANDLE
Definition: winbase.h:302
#define RTS_CONTROL_DISABLE
Definition: winbase.h:572
#define FILE_CURRENT
Definition: winbase.h:121
#define INVALID_FILE_SIZE
Definition: winbase.h:584
#define DTR_CONTROL_ENABLE
Definition: winbase.h:570
enum _GET_FILEEX_INFO_LEVELS GET_FILEEX_INFO_LEVELS
#define FILE_TYPE_CHAR
Definition: winbase.h:293
#define FILE_TYPE_PIPE
Definition: winbase.h:294
@ GetFileExInfoStandard
Definition: winbase.h:1202
#define SECURITY_SQOS_PRESENT
Definition: winbase.h:582
#define SECURITY_EFFECTIVE_ONLY
Definition: winbase.h:581
#define WAIT_FAILED
Definition: winbase.h:446
#define CLRBREAK
Definition: winbase.h:265
#define SETBREAK
Definition: winbase.h:264
#define MOVEFILE_DELAY_UNTIL_REBOOT
Definition: winbase.h:433
#define SECURITY_CONTEXT_TRACKING
Definition: winbase.h:580
enum _FINDEX_INFO_LEVELS FINDEX_INFO_LEVELS
#define CE_RXOVER
Definition: winbase.h:151
@ FindExInfoStandard
Definition: winbase.h:1169
@ FindExInfoBasic
Definition: winbase.h:1170
#define FILE_TYPE_DISK
Definition: winbase.h:292
#define CE_FRAME
Definition: winbase.h:145
CONST void * LPCVOID
Definition: windef.h:191
#define WINAPI
Definition: msvc.h:6
#define ERROR_IO_INCOMPLETE
Definition: winerror.h:576
#define ERROR_SHARING_VIOLATION
Definition: winerror.h:135
#define ERROR_UNABLE_TO_MOVE_REPLACEMENT
Definition: winerror.h:697
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define ERROR_DIRECTORY
Definition: winerror.h:295
#define ERROR_NEGATIVE_SEEK
Definition: winerror.h:203
#define ERROR_BAD_PATHNAME
Definition: winerror.h:233
#define ERROR_GEN_FAILURE
Definition: winerror.h:134
#define ERROR_HANDLE_EOF
Definition: winerror.h:140
#define ERROR_FILE_EXISTS
Definition: winerror.h:165
#define ERROR_UNABLE_TO_MOVE_REPLACEMENT_2
Definition: winerror.h:698
#define ERROR_NO_MORE_FILES
Definition: winerror.h:121
#define ERROR_FILENAME_EXCED_RANGE
Definition: winerror.h:263
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define CSTR_EQUAL
Definition: winnls.h:476
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1116
#define FILE_NOTIFY_CHANGE_SIZE
#define FILE_ATTRIBUTE_INTEGRITY_STREAM
#define RtlUnicodeStringToOemSize(STRING)
#define RtlUnicodeStringToAnsiSize(String)
Definition: rtlfuncs.h:1022
#define SECURITY_STATIC_TRACKING
Definition: setypes.h:104
#define SECURITY_DYNAMIC_TRACKING
Definition: setypes.h:103
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
char CHAR
Definition: xmlstorage.h:175
unsigned char BYTE
Definition: xxhash.c:193