3
3
// SPDX-FileCopyrightText: 2019-2022 Stefan Schmidt
4
4
// SPDX-FileCopyrightText: 2021 Erik Abair
5
5
6
- #include <fileapi.h>
7
- #include <handleapi.h>
8
- #include <winbase.h>
9
- #include <winerror.h>
10
6
#include <assert.h>
11
7
#include <ctype.h>
8
+ #include <fileapi.h>
9
+ #include <handleapi.h>
12
10
#include <stdbool.h>
13
11
#include <string.h>
12
+ #include <winbase.h>
13
+ #include <winerror.h>
14
14
#include <xboxkrnl/xboxkrnl.h>
15
15
16
16
DWORD GetFileAttributesA (LPCSTR lpFileName )
@@ -356,26 +356,26 @@ BOOL CopyFileA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExi
356
356
InitializeObjectAttributes (& objectAttributes , & targetPath , OBJ_CASE_INSENSITIVE , ObDosDevicesDirectory (), NULL );
357
357
358
358
status = NtCreateFile (
359
- & targetHandle ,
360
- FILE_GENERIC_WRITE ,
361
- & objectAttributes ,
362
- & ioStatusBlock ,
363
- & networkOpenInformation .AllocationSize ,
364
- networkOpenInformation .FileAttributes ,
365
- 0 ,
366
- bFailIfExists ? FILE_CREATE : FILE_SUPERSEDE ,
367
- FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE | FILE_SEQUENTIAL_ONLY );
359
+ & targetHandle ,
360
+ FILE_GENERIC_WRITE ,
361
+ & objectAttributes ,
362
+ & ioStatusBlock ,
363
+ & networkOpenInformation .AllocationSize ,
364
+ networkOpenInformation .FileAttributes ,
365
+ 0 ,
366
+ bFailIfExists ? FILE_CREATE : FILE_SUPERSEDE ,
367
+ FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE | FILE_SEQUENTIAL_ONLY );
368
368
if (!NT_SUCCESS (status )) {
369
369
NtClose (sourceHandle );
370
370
SetLastError (RtlNtStatusToDosError (status ));
371
371
return FALSE;
372
372
}
373
373
374
374
status = NtAllocateVirtualMemory (& readBuffer ,
375
- 0 ,
376
- & readBufferRegionSize ,
377
- MEM_RESERVE | MEM_COMMIT ,
378
- PAGE_READWRITE );
375
+ 0 ,
376
+ & readBufferRegionSize ,
377
+ MEM_RESERVE | MEM_COMMIT ,
378
+ PAGE_READWRITE );
379
379
if (!NT_SUCCESS (status )) {
380
380
NtClose (sourceHandle );
381
381
NtClose (targetHandle );
@@ -418,11 +418,11 @@ BOOL CopyFileA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExi
418
418
fileBasicInformation .LastWriteTime = networkOpenInformation .LastWriteTime ;
419
419
fileBasicInformation .FileAttributes = networkOpenInformation .FileAttributes ;
420
420
status = NtSetInformationFile (
421
- targetHandle ,
422
- & ioStatusBlock ,
423
- & fileBasicInformation ,
424
- sizeof (fileBasicInformation ),
425
- FileBasicInformation );
421
+ targetHandle ,
422
+ & ioStatusBlock ,
423
+ & fileBasicInformation ,
424
+ sizeof (fileBasicInformation ),
425
+ FileBasicInformation );
426
426
if (!NT_SUCCESS (status )) {
427
427
SetLastError (RtlNtStatusToDosError (status ));
428
428
NtClose (sourceHandle );
@@ -439,8 +439,8 @@ BOOL CopyFileA (LPCSTR lpExistingFileName, LPCSTR lpNewFileName, BOOL bFailIfExi
439
439
440
440
status = NtClose (targetHandle );
441
441
if (!NT_SUCCESS (status )) {
442
- SetLastError (RtlNtStatusToDosError (status ));
443
- return FALSE;
442
+ SetLastError (RtlNtStatusToDosError (status ));
443
+ return FALSE;
444
444
}
445
445
return TRUE;
446
446
}
@@ -555,7 +555,8 @@ DWORD GetLogicalDrives (VOID)
555
555
ANSI_STRING path ;
556
556
HANDLE handle ;
557
557
OBJECT_ATTRIBUTES attributes ;
558
- struct {
558
+ struct
559
+ {
559
560
OBJECT_DIRECTORY_INFORMATION objDirInfo ;
560
561
CHAR filenameBuf [2 ];
561
562
} objDirInfoBuf ;
@@ -614,7 +615,7 @@ DWORD GetLogicalDriveStringsA (DWORD nBufferLength, LPSTR lpBuffer)
614
615
}
615
616
616
617
if (nBufferLength == 0 || nBufferLength < requiredBufLength ) {
617
- return requiredBufLength + 1 ;
618
+ return requiredBufLength + 1 ;
618
619
}
619
620
620
621
for (int bit = 0 ; bit < 26 ; bit ++ ) {
0 commit comments