mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[NETAPI32] Implement NetpAllocWStrFromStr(), NetpAllocWStrFromAnsiStr() (not public, but useful) and NetpAllocWStrFromWStr().
This commit is contained in:
parent
9a39315d46
commit
968bdeddf3
3 changed files with 107 additions and 6 deletions
|
@ -135,6 +135,91 @@ NetUnregisterDomainNameChangeNotification(
|
|||
}
|
||||
|
||||
|
||||
PWSTR
|
||||
WINAPI
|
||||
NetpAllocWStrFromAnsiStr(
|
||||
_In_ PSTR InString)
|
||||
{
|
||||
ANSI_STRING AnsiString;
|
||||
UNICODE_STRING UnicodeString;
|
||||
ULONG Size;
|
||||
NET_API_STATUS NetStatus;
|
||||
NTSTATUS Status;
|
||||
|
||||
RtlInitAnsiString(&AnsiString, InString);
|
||||
|
||||
Size = RtlAnsiStringToUnicodeSize(&AnsiString);
|
||||
NetStatus = NetApiBufferAllocate(Size,
|
||||
(PVOID*)&UnicodeString.Buffer);
|
||||
if (NetStatus != NERR_Success)
|
||||
return NULL;
|
||||
|
||||
Status = RtlAnsiStringToUnicodeString(&UnicodeString,
|
||||
&AnsiString,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NetApiBufferFree(UnicodeString.Buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return UnicodeString.Buffer;
|
||||
}
|
||||
|
||||
|
||||
PWSTR
|
||||
WINAPI
|
||||
NetpAllocWStrFromStr(
|
||||
_In_ PSTR InString)
|
||||
{
|
||||
OEM_STRING OemString;
|
||||
UNICODE_STRING UnicodeString;
|
||||
ULONG Size;
|
||||
NET_API_STATUS NetStatus;
|
||||
NTSTATUS Status;
|
||||
|
||||
RtlInitAnsiString((PANSI_STRING)&OemString, InString);
|
||||
|
||||
Size = RtlOemStringToUnicodeSize(&OemString);
|
||||
NetStatus = NetApiBufferAllocate(Size,
|
||||
(PVOID*)&UnicodeString.Buffer);
|
||||
if (NetStatus != NERR_Success)
|
||||
return NULL;
|
||||
|
||||
Status = RtlOemStringToUnicodeString(&UnicodeString,
|
||||
&OemString,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
NetApiBufferFree(UnicodeString.Buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return UnicodeString.Buffer;
|
||||
}
|
||||
|
||||
|
||||
PWSTR
|
||||
WINAPI
|
||||
NetpAllocWStrFromWStr(
|
||||
_In_ PWSTR InString)
|
||||
{
|
||||
PWSTR OutString;
|
||||
ULONG Size;
|
||||
NET_API_STATUS Status;
|
||||
|
||||
Size = (wcslen(InString) + 1) * sizeof(WCHAR);
|
||||
Status = NetApiBufferAllocate(Size,
|
||||
(PVOID*)&OutString);
|
||||
if (Status != NERR_Success)
|
||||
return NULL;
|
||||
|
||||
wcscpy(OutString, InString);
|
||||
|
||||
return OutString;
|
||||
}
|
||||
|
||||
|
||||
NET_API_STATUS
|
||||
WINAPI
|
||||
NetpNtStatusToApiStatus(
|
||||
|
|
|
@ -33,10 +33,6 @@
|
|||
extern LIST_ENTRY g_EnumContextListHead;
|
||||
extern CRITICAL_SECTION g_EnumContextListLock;
|
||||
|
||||
NET_API_STATUS
|
||||
WINAPI
|
||||
NetpNtStatusToApiStatus(NTSTATUS Status);
|
||||
|
||||
/* misc.c */
|
||||
|
||||
NTSTATUS
|
||||
|
@ -68,6 +64,26 @@ CopySidFromSidAndRid(
|
|||
_In_ PSID SrcSid,
|
||||
_In_ ULONG RelativeId);
|
||||
|
||||
PWSTR
|
||||
WINAPI
|
||||
NetpAllocWStrFromAnsiStr(
|
||||
_In_ PSTR InString);
|
||||
|
||||
PWSTR
|
||||
WINAPI
|
||||
NetpAllocWStrFromStr(
|
||||
_In_ PSTR InString);
|
||||
|
||||
PWSTR
|
||||
WINAPI
|
||||
NetpAllocWStrFromWStr(
|
||||
_In_ PWSTR InString);
|
||||
|
||||
NET_API_STATUS
|
||||
WINAPI
|
||||
NetpNtStatusToApiStatus(
|
||||
_In_ NTSTATUS Status);
|
||||
|
||||
/* wksta.c */
|
||||
|
||||
BOOL
|
||||
|
|
|
@ -269,8 +269,8 @@
|
|||
@ stub NetpAllocConfigName
|
||||
@ stub NetpAllocFtinfoEntry
|
||||
@ stub NetpAllocStrFromWStr
|
||||
@ stub NetpAllocWStrFromStr
|
||||
@ stub NetpAllocWStrFromWStr
|
||||
@ stdcall NetpAllocWStrFromStr(str)
|
||||
@ stdcall NetpAllocWStrFromWStr(wstr)
|
||||
@ stub NetpApiStatusToNtStatus
|
||||
@ stub NetpAssertFailed
|
||||
@ stub NetpCleanFtinfoContext
|
||||
|
|
Loading…
Reference in a new issue