ReactOS 0.4.15-dev-5672-gf73ac17
path.c File Reference
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <wine/winternl.h>
#include <wine/debug.h>
Include dependency graph for path.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (path)
 
static BOOL set_ntstatus (NTSTATUS status)
 
WCHAR *CDECL wine_get_dos_file_name (LPCSTR str)
 

Function Documentation

◆ set_ntstatus()

static BOOL set_ntstatus ( NTSTATUS  status)
inlinestatic

Definition at line 30 of file path.c.

31{
33 return !status;
34}
#define SetLastError(x)
Definition: compat.h:752
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
Definition: ps.c:97

Referenced by wine_get_dos_file_name().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( path  )

◆ wine_get_dos_file_name()

WCHAR *CDECL wine_get_dos_file_name ( LPCSTR  str)

Definition at line 42 of file path.c.

43{
44 UNICODE_STRING nt_name;
47 SIZE_T len = strlen(str) + 1;
48
49 if (str[0] != '/') /* relative path name */
50 {
51 if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
55 if (!set_ntstatus( status )) return NULL;
56 buffer = nt_name.Buffer;
57 len = nt_name.Length / sizeof(WCHAR) + 1;
58 }
59 else
60 {
61#ifdef __REACTOS__
62 ERR("Got absolute UNIX path name in function wine_get_dos_file_name. This is not UNIX. Please fix the caller!\n");
63 ERR("File name: %s\n", str);
64#else
65 len += 8; /* \??\unix prefix */
66 if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL;
68 {
70 return NULL;
71 }
72#endif
73 }
74 if (buffer[5] == ':')
75 {
76 /* get rid of the \??\ prefix */
77 /* FIXME: should implement RtlNtPathNameToDosPathName and use that instead */
78 memmove( buffer, buffer + 4, (len - 4) * sizeof(WCHAR) );
79 }
80 else buffer[1] = '\\';
81 return buffer;
82}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
LONG NTSTATUS
Definition: precomp.h:26
#define ERR(fmt,...)
Definition: debug.h:110
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define NULL
Definition: types.h:112
#define CP_UNIXCP
Definition: compat.h:79
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
GLuint buffer
Definition: glext.h:5915
GLenum GLsizei len
Definition: glext.h:6722
NTSYSAPI NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(PCWSTR, PUNICODE_STRING, PWSTR *, CURDIR *)
NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name(const ANSI_STRING *name, UNICODE_STRING *nt)
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
const WCHAR * str
static BOOL set_ntstatus(NTSTATUS status)
Definition: path.c:30
ULONG_PTR SIZE_T
Definition: typedefs.h:80
__wchar_t WCHAR
Definition: xmlstorage.h:180