ReactOS  0.4.15-dev-1397-g19779b3
vista.c File Reference
#include <k32_vista.h>
#include <debug.h>
Include dependency graph for vista.c:

Go to the source code of this file.

Macros

#define REPARSE_DATA_BUFFER_HEADER_SIZE   FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
 
#define NDEBUG
 

Functions

BOOL WINAPI QueryFullProcessImageNameW (HANDLE hProcess, DWORD dwFlags, LPWSTR lpExeName, PDWORD pdwSize)
 
BOOL WINAPI QueryFullProcessImageNameA (HANDLE hProcess, DWORD dwFlags, LPSTR lpExeName, PDWORD pdwSize)
 
HRESULT WINAPI GetApplicationRecoveryCallback (IN HANDLE hProcess, OUT APPLICATION_RECOVERY_CALLBACK *pRecoveryCallback, OUT PVOID *ppvParameter, PDWORD dwPingInterval, PDWORD dwFlags)
 
HRESULT WINAPI GetApplicationRestart (IN HANDLE hProcess, OUT PWSTR pwzCommandline OPTIONAL, IN OUT PDWORD pcchSize, OUT PDWORD pdwFlags OPTIONAL)
 
VOID WINAPI ApplicationRecoveryFinished (IN BOOL bSuccess)
 
HRESULT WINAPI ApplicationRecoveryInProgress (OUT PBOOL pbCancelled)
 
HRESULT WINAPI RegisterApplicationRecoveryCallback (IN APPLICATION_RECOVERY_CALLBACK pRecoveryCallback, IN PVOID pvParameter OPTIONAL, DWORD dwPingInterval, DWORD dwFlags)
 
HRESULT WINAPI RegisterApplicationRestart (IN PCWSTR pwzCommandline OPTIONAL, IN DWORD dwFlags)
 
BOOLEAN WINAPI CreateSymbolicLinkW (IN LPCWSTR lpSymlinkFileName, IN LPCWSTR lpTargetFileName, IN DWORD dwFlags)
 
BOOLEAN NTAPI CreateSymbolicLinkA (IN LPCSTR lpSymlinkFileName, IN LPCSTR lpTargetFileName, IN DWORD dwFlags)
 
DWORD WINAPI GetFinalPathNameByHandleW (IN HANDLE hFile, OUT LPWSTR lpszFilePath, IN DWORD cchFilePath, IN DWORD dwFlags)
 
DWORD WINAPI GetFinalPathNameByHandleA (IN HANDLE hFile, OUT LPSTR lpszFilePath, IN DWORD cchFilePath, IN DWORD dwFlags)
 
BOOL WINAPI SetFileBandwidthReservation (IN HANDLE hFile, IN DWORD nPeriodMilliseconds, IN DWORD nBytesPerPeriod, IN BOOL bDiscardable, OUT LPDWORD lpTransferSize, OUT LPDWORD lpNumOutstandingRequests)
 
BOOL WINAPI GetFileBandwidthReservation (IN HANDLE hFile, OUT LPDWORD lpPeriodMilliseconds, OUT LPDWORD lpBytesPerPeriod, OUT LPBOOL pDiscardable, OUT LPDWORD lpTransferSize, OUT LPDWORD lpNumOutstandingRequests)
 
HANDLE WINAPI OpenFileById (IN HANDLE hFile, IN LPFILE_ID_DESCRIPTOR lpFileID, IN DWORD dwDesiredAccess, IN DWORD dwShareMode, IN LPSECURITY_ATTRIBUTES lpSecurityAttributes OPTIONAL, IN DWORD dwFlags)
 
BOOL WINAPI GetFileMUIInfo (DWORD dwFlags, PCWSTR pcwszFilePath, PFILEMUIINFO pFileMUIInfo, DWORD *pcbFileMUIInfo)
 
BOOL WINAPI GetFileMUIPath (DWORD dwFlags, PCWSTR pcwszFilePath, PWSTR pwszLanguage, PULONG pcchLanguage, PWSTR pwszFileMUIPath, PULONG pcchFileMUIPath, PULONGLONG pululEnumerator)
 
BOOL WINAPI GetSystemPreferredUILanguages (DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
 
BOOL WINAPI GetThreadPreferredUILanguages (DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
 
LANGID WINAPI GetThreadUILanguage (VOID)
 
BOOL WINAPI GetUILanguageInfo (DWORD dwFlags, PCZZWSTR pwmszLanguage, PZZWSTR pwszFallbackLanguages, PDWORD pcchFallbackLanguages, PDWORD pdwAttributes)
 
BOOL WINAPI GetUserPreferredUILanguages (DWORD dwFlags, PULONG pulNumLanguages, PZZWSTR pwszLanguagesBuffer, PULONG pcchLanguagesBuffer)
 
BOOL WINAPI SetThreadPreferredUILanguages (DWORD dwFlags, PCZZWSTR pwszLanguagesBuffer, PULONG pulNumLanguages)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 19 of file vista.c.

◆ REPARSE_DATA_BUFFER_HEADER_SIZE

#define REPARSE_DATA_BUFFER_HEADER_SIZE   FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)

Definition at line 17 of file vista.c.

Function Documentation

◆ ApplicationRecoveryFinished()

VOID WINAPI ApplicationRecoveryFinished ( IN BOOL  bSuccess)

Definition at line 164 of file vista.c.

165 {
167 }
#define UNIMPLEMENTED
Definition: debug.h:115

◆ ApplicationRecoveryInProgress()

HRESULT WINAPI ApplicationRecoveryInProgress ( OUT PBOOL  pbCancelled)

Definition at line 175 of file vista.c.

176 {
178  return E_FAIL;
179 }
#define E_FAIL
Definition: ddrawi.h:102
#define UNIMPLEMENTED
Definition: debug.h:115

◆ CreateSymbolicLinkA()

BOOLEAN NTAPI CreateSymbolicLinkA ( IN LPCSTR  lpSymlinkFileName,
IN LPCSTR  lpTargetFileName,
IN DWORD  dwFlags 
)

Definition at line 418 of file vista.c.

421 {
422  PWCHAR SymlinkW, TargetW;
423  BOOLEAN Ret;
424 
425  if(!lpSymlinkFileName || !lpTargetFileName)
426  {
428  return FALSE;
429  }
430 
431  if (!(SymlinkW = FilenameA2W(lpSymlinkFileName, FALSE)))
432  return FALSE;
433 
434  if (!(TargetW = FilenameA2W(lpTargetFileName, TRUE)))
435  return FALSE;
436 
437  Ret = CreateSymbolicLinkW(SymlinkW,
438  TargetW,
439  dwFlags);
440 
441  RtlFreeHeap(RtlGetProcessHeap(), 0, SymlinkW);
442  RtlFreeHeap(RtlGetProcessHeap(), 0, TargetW);
443 
444  return Ret;
445 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
uint16_t * PWCHAR
Definition: typedefs.h:56
#define FALSE
Definition: types.h:117
unsigned char BOOLEAN
BOOLEAN WINAPI CreateSymbolicLinkW(IN LPCWSTR lpSymlinkFileName, IN LPCWSTR lpTargetFileName, IN DWORD dwFlags)
Definition: vista.c:215
#define SetLastError(x)
Definition: compat.h:611
PWCHAR FilenameA2W(LPCSTR NameA, BOOL alloc)
Definition: fileutils.c:18
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175

◆ CreateSymbolicLinkW()

BOOLEAN WINAPI CreateSymbolicLinkW ( IN LPCWSTR  lpSymlinkFileName,
IN LPCWSTR  lpTargetFileName,
IN DWORD  dwFlags 
)

Definition at line 215 of file vista.c.

218 {
221  HANDLE hSymlink = NULL;
222  UNICODE_STRING SymlinkFileName = { 0, 0, NULL };
223  UNICODE_STRING TargetFileName = { 0, 0, NULL };
224  BOOLEAN bAllocatedTarget = FALSE, bRelativePath = FALSE;
225  LPWSTR lpTargetFullFileName = NULL;
226  SIZE_T cbPrintName;
227  SIZE_T cbReparseData;
228  PREPARSE_DATA_BUFFER pReparseData = NULL;
229  PBYTE pBufTail;
231  ULONG dwCreateOptions;
232  DWORD dwErr;
233 
234  if(!lpSymlinkFileName || !lpTargetFileName || (dwFlags | SYMBOLIC_LINK_FLAG_DIRECTORY) != SYMBOLIC_LINK_FLAG_DIRECTORY)
235  {
237  return FALSE;
238  }
239 
240  if(dwFlags & SYMBOLIC_LINK_FLAG_DIRECTORY)
241  dwCreateOptions = FILE_DIRECTORY_FILE;
242  else
243  dwCreateOptions = FILE_NON_DIRECTORY_FILE;
244 
245  switch(RtlDetermineDosPathNameType_U(lpTargetFileName))
246  {
247  case RtlPathTypeUnknown:
248  case RtlPathTypeRooted:
249  case RtlPathTypeRelative:
250  bRelativePath = TRUE;
251  RtlInitUnicodeString(&TargetFileName, lpTargetFileName);
252  break;
253 
255  {
256  LPWSTR FilePart;
257  SIZE_T cchTargetFullFileName;
258 
259  cchTargetFullFileName = GetFullPathNameW(lpTargetFileName, 0, NULL, &FilePart);
260 
261  if(cchTargetFullFileName == 0)
262  {
263  dwErr = GetLastError();
264  goto Cleanup;
265  }
266 
267  lpTargetFullFileName = RtlAllocateHeap(RtlGetProcessHeap(), 0, cchTargetFullFileName * sizeof(WCHAR));
268 
269  if(lpTargetFullFileName == NULL)
270  {
272  goto Cleanup;
273  }
274 
275  if(GetFullPathNameW(lpTargetFileName, cchTargetFullFileName, lpTargetFullFileName, &FilePart) == 0)
276  {
277  dwErr = GetLastError();
278  goto Cleanup;
279  }
280  }
281 
282  lpTargetFileName = lpTargetFullFileName;
283 
284  // fallthrough
285 
290  default:
291  if(!RtlDosPathNameToNtPathName_U(lpTargetFileName, &TargetFileName, NULL, NULL))
292  {
293  bAllocatedTarget = TRUE;
295  goto Cleanup;
296  }
297  }
298 
299  cbPrintName = wcslen(lpTargetFileName) * sizeof(WCHAR);
300  cbReparseData = FIELD_OFFSET(REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer.PathBuffer) + TargetFileName.Length + cbPrintName;
301  pReparseData = RtlAllocateHeap(RtlGetProcessHeap(), 0, cbReparseData);
302 
303  if(pReparseData == NULL)
304  {
306  goto Cleanup;
307  }
308 
309  pBufTail = (PBYTE)(pReparseData->SymbolicLinkReparseBuffer.PathBuffer);
310 
311  pReparseData->ReparseTag = (ULONG)IO_REPARSE_TAG_SYMLINK;
312  pReparseData->ReparseDataLength = (USHORT)cbReparseData - REPARSE_DATA_BUFFER_HEADER_SIZE;
313  pReparseData->Reserved = 0;
314 
315  pReparseData->SymbolicLinkReparseBuffer.SubstituteNameOffset = 0;
316  pReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength = TargetFileName.Length;
317  pBufTail += pReparseData->SymbolicLinkReparseBuffer.SubstituteNameOffset;
318  RtlCopyMemory(pBufTail, TargetFileName.Buffer, TargetFileName.Length);
319 
320  pReparseData->SymbolicLinkReparseBuffer.PrintNameOffset = pReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength;
321  pReparseData->SymbolicLinkReparseBuffer.PrintNameLength = (USHORT)cbPrintName;
322  pBufTail += pReparseData->SymbolicLinkReparseBuffer.PrintNameOffset;
323  RtlCopyMemory(pBufTail, lpTargetFileName, cbPrintName);
324 
325  pReparseData->SymbolicLinkReparseBuffer.Flags = 0;
326 
327  if(bRelativePath)
328  pReparseData->SymbolicLinkReparseBuffer.Flags |= 1; // TODO! give this lone flag a name
329 
330  if(!RtlDosPathNameToNtPathName_U(lpSymlinkFileName, &SymlinkFileName, NULL, NULL))
331  {
333  goto Cleanup;
334  }
335 
337 
339  (
340  &hSymlink,
343  &IoStatusBlock,
344  NULL,
346  0,
347  FILE_CREATE,
349  NULL,
350  0
351  );
352 
353  if(!NT_SUCCESS(Status))
354  {
356  goto Cleanup;
357  }
358 
360  (
361  hSymlink,
362  NULL,
363  NULL,
364  NULL,
365  &IoStatusBlock,
367  pReparseData,
368  cbReparseData,
369  NULL,
370  0
371  );
372 
373  if(!NT_SUCCESS(Status))
374  {
376  DispInfo.DeleteFile = TRUE;
377  NtSetInformationFile(hSymlink, &IoStatusBlock, &DispInfo, sizeof(DispInfo), FileDispositionInformation);
378 
380  goto Cleanup;
381  }
382 
383  dwErr = NO_ERROR;
384 
385 Cleanup:
386  if(hSymlink)
387  NtClose(hSymlink);
388 
389  RtlFreeUnicodeString(&SymlinkFileName);
390  if (bAllocatedTarget)
391  {
392  RtlFreeHeap(RtlGetProcessHeap(),
393  0,
394  TargetFileName.Buffer);
395  }
396 
397  if(lpTargetFullFileName)
398  RtlFreeHeap(RtlGetProcessHeap(), 0, lpTargetFullFileName);
399 
400  if(pReparseData)
401  RtlFreeHeap(RtlGetProcessHeap(), 0, pReparseData);
402 
403  if(dwErr)
404  {
406  return FALSE;
407  }
408 
409  return TRUE;
410 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
NTSTATUS NTAPI NtSetInformationFile(HANDLE hFile, PIO_STATUS_BLOCK io, PVOID ptr, ULONG len, FILE_INFORMATION_CLASS FileInformationClass)
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
struct _REPARSE_DATA_BUFFER::@310::@312 SymbolicLinkReparseBuffer
#define TRUE
Definition: types.h:120
#define FILE_DIRECTORY_FILE
Definition: constants.h:491
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define FILE_CREATE
Definition: from_kernel.h:55
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
DWORD WINAPI GetFullPathNameW(IN LPCWSTR lpFileName, IN DWORD nBufferLength, OUT LPWSTR lpBuffer, OUT LPWSTR *lpFilePart)
Definition: path.c:1105
NTSYSCALLAPI NTSTATUS NTAPI NtFsControlFile(HANDLE FileHandle, HANDLE Event, PIO_APC_ROUTINE ApcRoutine, PVOID ApcContext, PIO_STATUS_BLOCK IoStatusBlock, ULONG FsControlCode, PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength)
#define NO_ERROR
Definition: dderror.h:5
#define FILE_WRITE_ATTRIBUTES
Definition: nt_native.h:649
WCHAR PathBuffer[1]
Definition: shellext.h:176
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
#define FALSE
Definition: types.h:117
#define REPARSE_DATA_BUFFER_HEADER_SIZE
Definition: vista.c:17
unsigned char BOOLEAN
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
DWORD dwErr
Definition: service.c:36
Status
Definition: gdiplustypes.h:24
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)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define SetLastError(x)
Definition: compat.h:611
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
USHORT ReparseDataLength
Definition: shellext.h:166
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define FILE_NON_DIRECTORY_FILE
Definition: constants.h:492
static const WCHAR Cleanup[]
Definition: register.c:80
#define SYNCHRONIZE
Definition: nt_native.h:61
ULONG_PTR SIZE_T
Definition: typedefs.h:80
unsigned short USHORT
Definition: pedump.c:61
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define NULL
Definition: types.h:112
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
#define FSCTL_SET_REPARSE_POINT
Definition: winioctl.h:98
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define FILE_OPEN_REPARSE_POINT
Definition: from_kernel.h:46
BYTE * PBYTE
Definition: pedump.c:66
#define IO_REPARSE_TAG_SYMLINK
Definition: iotypes.h:7219
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
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)
#define DELETE
Definition: nt_native.h:57
NTSYSAPI RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_U(_In_ PCWSTR Path)

Referenced by CreateSymbolicLinkA().

◆ GetApplicationRecoveryCallback()

HRESULT WINAPI GetApplicationRecoveryCallback ( IN HANDLE  hProcess,
OUT APPLICATION_RECOVERY_CALLBACK *  pRecoveryCallback,
OUT PVOID ppvParameter,
PDWORD  dwPingInterval,
PDWORD  dwFlags 
)

Definition at line 133 of file vista.c.

138 {
140  return E_FAIL;
141 }
#define E_FAIL
Definition: ddrawi.h:102
#define UNIMPLEMENTED
Definition: debug.h:115

◆ GetApplicationRestart()

HRESULT WINAPI GetApplicationRestart ( IN HANDLE  hProcess,
OUT PWSTR pwzCommandline  OPTIONAL,
IN OUT PDWORD  pcchSize,
OUT PDWORD pdwFlags  OPTIONAL 
)

Definition at line 149 of file vista.c.

153 {
155  return E_FAIL;
156 }
#define E_FAIL
Definition: ddrawi.h:102
#define UNIMPLEMENTED
Definition: debug.h:115

◆ GetFileBandwidthReservation()

BOOL WINAPI GetFileBandwidthReservation ( IN HANDLE  hFile,
OUT LPDWORD  lpPeriodMilliseconds,
OUT LPDWORD  lpBytesPerPeriod,
OUT LPBOOL  pDiscardable,
OUT LPDWORD  lpTransferSize,
OUT LPDWORD  lpNumOutstandingRequests 
)

Definition at line 560 of file vista.c.

566 {
568  return FALSE;
569 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ GetFileMUIInfo()

BOOL WINAPI GetFileMUIInfo ( DWORD  dwFlags,
PCWSTR  pcwszFilePath,
PFILEMUIINFO  pFileMUIInfo,
DWORD pcbFileMUIInfo 
)

Definition at line 606 of file vista.c.

611 {
612  DPRINT1("%x %p %p %p\n", dwFlags, pcwszFilePath, pFileMUIInfo, pcbFileMUIInfo);
614  return FALSE;
615 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPRINT1
Definition: precomp.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ GetFileMUIPath()

BOOL WINAPI GetFileMUIPath ( DWORD  dwFlags,
PCWSTR  pcwszFilePath,
PWSTR  pwszLanguage,
PULONG  pcchLanguage,
PWSTR  pwszFileMUIPath,
PULONG  pcchFileMUIPath,
PULONGLONG  pululEnumerator 
)

Definition at line 622 of file vista.c.

630 {
631  DPRINT1("%x %p %p %p %p %p\n", dwFlags, pcwszFilePath, pwszLanguage, pwszFileMUIPath, pcchFileMUIPath, pululEnumerator);
633  return FALSE;
634 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPRINT1
Definition: precomp.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ GetFinalPathNameByHandleA()

DWORD WINAPI GetFinalPathNameByHandleA ( IN HANDLE  hFile,
OUT LPSTR  lpszFilePath,
IN DWORD  cchFilePath,
IN DWORD  dwFlags 
)

Definition at line 475 of file vista.c.

479 {
480  WCHAR FilePathW[MAX_PATH];
481  UNICODE_STRING FilePathU;
482  DWORD PrevLastError;
483  DWORD Ret = 0;
484 
485  if (cchFilePath != 0 &&
486  cchFilePath > sizeof(FilePathW) / sizeof(FilePathW[0]))
487  {
488  FilePathU.Length = 0;
489  FilePathU.MaximumLength = (USHORT)cchFilePath * sizeof(WCHAR);
490  FilePathU.Buffer = RtlAllocateHeap(RtlGetProcessHeap(),
491  0,
492  FilePathU.MaximumLength);
493  if (FilePathU.Buffer == NULL)
494  {
496  return 0;
497  }
498  }
499  else
500  {
501  FilePathU.Length = 0;
502  FilePathU.MaximumLength = sizeof(FilePathW);
503  FilePathU.Buffer = FilePathW;
504  }
505 
506  /* save the last error code */
507  PrevLastError = GetLastError();
509 
510  /* call the unicode version that does all the work */
512  FilePathU.Buffer,
513  cchFilePath,
514  dwFlags);
515 
516  if (GetLastError() == ERROR_SUCCESS)
517  {
518  /* no error, restore the last error code and convert the string */
519  SetLastError(PrevLastError);
520 
521  Ret = FilenameU2A_FitOrFail(lpszFilePath,
522  cchFilePath,
523  &FilePathU);
524  }
525 
526  /* free allocated memory if necessary */
527  if (FilePathU.Buffer != FilePathW)
528  {
529  RtlFreeHeap(RtlGetProcessHeap(),
530  0,
531  FilePathU.Buffer);
532  }
533 
534  return Ret;
535 }
#define ERROR_SUCCESS
Definition: deptool.c:10
USHORT MaximumLength
Definition: env_spec_w32.h:370
DWORD WINAPI GetFinalPathNameByHandleW(IN HANDLE hFile, OUT LPWSTR lpszFilePath, IN DWORD cchFilePath, IN DWORD dwFlags)
Definition: vista.c:453
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU)
Definition: fileutils.c:56
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
_In_ HANDLE hFile
Definition: mswsock.h:90
unsigned short USHORT
Definition: pedump.c:61
#define NULL
Definition: types.h:112

◆ GetFinalPathNameByHandleW()

DWORD WINAPI GetFinalPathNameByHandleW ( IN HANDLE  hFile,
OUT LPWSTR  lpszFilePath,
IN DWORD  cchFilePath,
IN DWORD  dwFlags 
)

Definition at line 453 of file vista.c.

457 {
458  if (dwFlags & ~(VOLUME_NAME_DOS | VOLUME_NAME_GUID | VOLUME_NAME_NT |
459  VOLUME_NAME_NONE | FILE_NAME_NORMALIZED | FILE_NAME_OPENED))
460  {
462  return 0;
463  }
464 
466  return 0;
467 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define UNIMPLEMENTED
Definition: debug.h:115

Referenced by GetFinalPathNameByHandleA().

◆ GetSystemPreferredUILanguages()

BOOL WINAPI GetSystemPreferredUILanguages ( DWORD  dwFlags,
PULONG  pulNumLanguages,
PZZWSTR  pwszLanguagesBuffer,
PULONG  pcchLanguagesBuffer 
)

Definition at line 659 of file vista.c.

664 {
665  DPRINT1("%x %p %p %p\n", dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
667  return FALSE;
668 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPRINT1
Definition: precomp.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

Referenced by InitFunctionPointers().

◆ GetThreadPreferredUILanguages()

BOOL WINAPI GetThreadPreferredUILanguages ( DWORD  dwFlags,
PULONG  pulNumLanguages,
PZZWSTR  pwszLanguagesBuffer,
PULONG  pcchLanguagesBuffer 
)

Definition at line 675 of file vista.c.

680 {
681  DPRINT1("%x %p %p %p\n", dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
683  return FALSE;
684 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPRINT1
Definition: precomp.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

Referenced by InitFunctionPointers().

◆ GetThreadUILanguage()

LANGID WINAPI GetThreadUILanguage ( VOID  )

Definition at line 691 of file vista.c.

692 {
695  return 0;
696 }
#define SetLastError(x)
Definition: compat.h:611
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define UNIMPLEMENTED
Definition: debug.h:115

◆ GetUILanguageInfo()

BOOL WINAPI GetUILanguageInfo ( DWORD  dwFlags,
PCZZWSTR  pwmszLanguage,
PZZWSTR  pwszFallbackLanguages,
PDWORD  pcchFallbackLanguages,
PDWORD  pdwAttributes 
)

Definition at line 703 of file vista.c.

709 {
710  DPRINT1("%x %p %p %p %p\n", dwFlags, pwmszLanguage, pwszFallbackLanguages, pcchFallbackLanguages, pdwAttributes);
712  return FALSE;
713 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPRINT1
Definition: precomp.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

◆ GetUserPreferredUILanguages()

BOOL WINAPI GetUserPreferredUILanguages ( DWORD  dwFlags,
PULONG  pulNumLanguages,
PZZWSTR  pwszLanguagesBuffer,
PULONG  pcchLanguagesBuffer 
)

Definition at line 721 of file vista.c.

726 {
727  DPRINT1("%x %p %p %p\n", dwFlags, pulNumLanguages, pwszLanguagesBuffer, pcchLanguagesBuffer);
729  return FALSE;
730 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPRINT1
Definition: precomp.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102

Referenced by InitFunctionPointers().

◆ OpenFileById()

HANDLE WINAPI OpenFileById ( IN HANDLE  hFile,
IN LPFILE_ID_DESCRIPTOR  lpFileID,
IN DWORD  dwDesiredAccess,
IN DWORD  dwShareMode,
IN LPSECURITY_ATTRIBUTES lpSecurityAttributes  OPTIONAL,
IN DWORD  dwFlags 
)

Definition at line 577 of file vista.c.

583 {
585  return INVALID_HANDLE_VALUE;
586 }
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define UNIMPLEMENTED
Definition: debug.h:115

◆ QueryFullProcessImageNameA()

BOOL WINAPI QueryFullProcessImageNameA ( HANDLE  hProcess,
DWORD  dwFlags,
LPSTR  lpExeName,
PDWORD  pdwSize 
)

Definition at line 92 of file vista.c.

96 {
97  DWORD pdwSizeW = *pdwSize;
98  BOOL Result;
99  LPWSTR lpExeNameW;
100 
101  lpExeNameW = RtlAllocateHeap(RtlGetProcessHeap(),
103  *pdwSize * sizeof(WCHAR));
104  if (!lpExeNameW)
105  {
107  return FALSE;
108  }
109 
110  Result = QueryFullProcessImageNameW(hProcess, dwFlags, lpExeNameW, &pdwSizeW);
111 
112  if (Result)
113  Result = (0 != WideCharToMultiByte(CP_ACP, 0,
114  lpExeNameW,
115  -1,
116  lpExeName,
117  *pdwSize,
118  NULL, NULL));
119 
120  if (Result)
121  *pdwSize = strlen(lpExeName);
122 
123  RtlFreeHeap(RtlGetProcessHeap(), 0, lpExeNameW);
124  return Result;
125 }
#define WideCharToMultiByte
Definition: compat.h:111
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define CP_ACP
Definition: compat.h:109
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static DWORD LPSTR lpExeName
Definition: process.c:72
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL WINAPI QueryFullProcessImageNameW(HANDLE hProcess, DWORD dwFlags, LPWSTR lpExeName, PDWORD pdwSize)
Definition: vista.c:29
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ QueryFullProcessImageNameW()

BOOL WINAPI QueryFullProcessImageNameW ( HANDLE  hProcess,
DWORD  dwFlags,
LPWSTR  lpExeName,
PDWORD  pdwSize 
)

Definition at line 29 of file vista.c.

33 {
34  BYTE Buffer[sizeof(UNICODE_STRING) + MAX_PATH * sizeof(WCHAR)];
38  DWORD Needed;
39 
42  Buffer,
43  sizeof(Buffer) - sizeof(WCHAR),
44  &Needed);
46  {
47  DynamicBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Needed + sizeof(WCHAR));
48  if (!DynamicBuffer)
49  {
51  return FALSE;
52  }
53 
57  Needed,
58  &Needed);
60  }
62 
63  if (!NT_SUCCESS(Status)) goto Cleanup;
64 
65  if (Result->Length / sizeof(WCHAR) + 1 > *pdwSize)
66  {
68  goto Cleanup;
69  }
70 
71  *pdwSize = Result->Length / sizeof(WCHAR);
72  memcpy(lpExeName, Result->Buffer, Result->Length);
73  lpExeName[*pdwSize] = 0;
74 
75 Cleanup:
76  RtlFreeHeap(RtlGetProcessHeap(), 0, DynamicBuffer);
77 
78  if (!NT_SUCCESS(Status))
79  {
81  }
82 
83  return !Status;
84 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
static DWORD LPSTR lpExeName
Definition: process.c:72
unsigned char * LPBYTE
Definition: typedefs.h:53
#define FALSE
Definition: types.h:117
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
Definition: bufpool.h:45
DWORD BaseSetLastNTError(IN NTSTATUS Status)
Definition: reactos.cpp:166
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
Status
Definition: gdiplustypes.h:24
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const WCHAR Cleanup[]
Definition: register.c:80
unsigned char BYTE
Definition: xxhash.c:193
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define NULL
Definition: types.h:112
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
struct _UNICODE_STRING UNICODE_STRING

Referenced by QueryFullProcessImageNameA().

◆ RegisterApplicationRecoveryCallback()

HRESULT WINAPI RegisterApplicationRecoveryCallback ( IN APPLICATION_RECOVERY_CALLBACK  pRecoveryCallback,
IN PVOID pvParameter  OPTIONAL,
DWORD  dwPingInterval,
DWORD  dwFlags 
)

Definition at line 187 of file vista.c.

191 {
193  return E_FAIL;
194 }
#define E_FAIL
Definition: ddrawi.h:102
#define UNIMPLEMENTED
Definition: debug.h:115

◆ RegisterApplicationRestart()

HRESULT WINAPI RegisterApplicationRestart ( IN PCWSTR pwzCommandline  OPTIONAL,
IN DWORD  dwFlags 
)

Definition at line 202 of file vista.c.

204 {
206  return E_FAIL;
207 }
#define E_FAIL
Definition: ddrawi.h:102
#define UNIMPLEMENTED
Definition: debug.h:115

◆ SetFileBandwidthReservation()

BOOL WINAPI SetFileBandwidthReservation ( IN HANDLE  hFile,
IN DWORD  nPeriodMilliseconds,
IN DWORD  nBytesPerPeriod,
IN BOOL  bDiscardable,
OUT LPDWORD  lpTransferSize,
OUT LPDWORD  lpNumOutstandingRequests 
)

Definition at line 543 of file vista.c.

549 {
551  return FALSE;
552 }
#define FALSE
Definition: types.h:117
#define UNIMPLEMENTED
Definition: debug.h:115

◆ SetThreadPreferredUILanguages()

BOOL WINAPI SetThreadPreferredUILanguages ( DWORD  dwFlags,
PCZZWSTR  pwszLanguagesBuffer,
PULONG  pulNumLanguages 
)

Definition at line 754 of file vista.c.

759 {
760  DPRINT1("%x %p %p\n", dwFlags, pwszLanguagesBuffer, pulNumLanguages);
762  return FALSE;
763 }
#define FALSE
Definition: types.h:117
#define SetLastError(x)
Definition: compat.h:611
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define DPRINT1
Definition: precomp.h:8
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102