Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
c4effa39
Commit
c4effa39
authored
May 07, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use the Unix codepage to convert the user name to Unicode.
parent
b37eab4e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
35 deletions
+42
-35
advapi.c
dlls/advapi32/advapi.c
+21
-16
reg.c
dlls/ntdll/reg.c
+8
-11
sec.c
dlls/ntdll/sec.c
+13
-8
No files found.
dlls/advapi32/advapi.c
View file @
c4effa39
...
@@ -53,21 +53,26 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
...
@@ -53,21 +53,26 @@ WINE_DEFAULT_DEBUG_CHANNEL(advapi);
BOOL
WINAPI
BOOL
WINAPI
GetUserNameA
(
LPSTR
lpszName
,
LPDWORD
lpSize
)
GetUserNameA
(
LPSTR
lpszName
,
LPDWORD
lpSize
)
{
{
size_t
len
;
WCHAR
*
buffer
;
const
char
*
name
=
wine_get_user_name
();
BOOL
ret
;
/* We need to include the null character when determining the size of the buffer. */
len
=
strlen
(
name
)
+
1
;
if
(
len
>
*
lpSize
)
{
SetLastError
(
ERROR_MORE_DATA
);
*
lpSize
=
len
;
return
0
;
}
*
lpSize
=
len
;
if
(
!
(
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
lpSize
*
2
*
sizeof
(
WCHAR
)
)))
strcpy
(
lpszName
,
name
);
{
return
1
;
SetLastError
(
ERROR_NOT_ENOUGH_MEMORY
);
return
FALSE
;
}
ret
=
GetUserNameW
(
buffer
,
*
lpSize
*
2
);
if
(
ret
)
{
if
(
!
(
*
lpSize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
buffer
,
-
1
,
lpszName
,
*
lpSize
,
NULL
,
NULL
)))
{
*
lpSize
=
WideCharToMultiByte
(
CP_ACP
,
0
,
buffer
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
SetLastError
(
ERROR_MORE_DATA
);
ret
=
FALSE
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
return
ret
;
}
}
/******************************************************************************
/******************************************************************************
...
@@ -79,7 +84,7 @@ BOOL WINAPI
...
@@ -79,7 +84,7 @@ BOOL WINAPI
GetUserNameW
(
LPWSTR
lpszName
,
LPDWORD
lpSize
)
GetUserNameW
(
LPWSTR
lpszName
,
LPDWORD
lpSize
)
{
{
const
char
*
name
=
wine_get_user_name
();
const
char
*
name
=
wine_get_user_name
();
DWORD
len
=
MultiByteToWideChar
(
CP_
A
CP
,
0
,
name
,
-
1
,
NULL
,
0
);
DWORD
len
=
MultiByteToWideChar
(
CP_
UNIX
CP
,
0
,
name
,
-
1
,
NULL
,
0
);
if
(
len
>
*
lpSize
)
if
(
len
>
*
lpSize
)
{
{
...
@@ -89,7 +94,7 @@ GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
...
@@ -89,7 +94,7 @@ GetUserNameW( LPWSTR lpszName, LPDWORD lpSize )
}
}
*
lpSize
=
len
;
*
lpSize
=
len
;
MultiByteToWideChar
(
CP_
A
CP
,
0
,
name
,
-
1
,
lpszName
,
len
);
MultiByteToWideChar
(
CP_
UNIX
CP
,
0
,
name
,
-
1
,
lpszName
,
len
);
return
TRUE
;
return
TRUE
;
}
}
...
...
dlls/ntdll/reg.c
View file @
c4effa39
...
@@ -728,20 +728,17 @@ NTSTATUS WINAPI NtUnloadKey(
...
@@ -728,20 +728,17 @@ NTSTATUS WINAPI NtUnloadKey(
*/
*/
NTSTATUS
WINAPI
RtlFormatCurrentUserKeyPath
(
IN
OUT
PUNICODE_STRING
KeyPath
)
NTSTATUS
WINAPI
RtlFormatCurrentUserKeyPath
(
IN
OUT
PUNICODE_STRING
KeyPath
)
{
{
static
const
WCHAR
pathW
[]
=
{
'\\'
,
'R'
,
'e'
,
'g'
,
'i'
,
's'
,
't'
,
'r'
,
'y'
,
'\\'
,
'U'
,
's'
,
'e'
,
'r'
,
'\\'
};
const
char
*
user
=
wine_get_user_name
();
const
char
*
user
=
wine_get_user_name
();
char
*
buffer
;
int
len
=
ntdll_umbstowcs
(
0
,
user
,
strlen
(
user
)
+
1
,
NULL
,
0
);
ANSI_STRING
AnsiPath
;
NTSTATUS
ret
;
if
(
!
(
buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
strlen
(
user
)
+
16
)))
KeyPath
->
MaximumLength
=
sizeof
(
pathW
)
+
len
*
sizeof
(
WCHAR
);
KeyPath
->
Length
=
KeyPath
->
MaximumLength
-
sizeof
(
WCHAR
);
if
(
!
(
KeyPath
->
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
KeyPath
->
MaximumLength
)))
return
STATUS_NO_MEMORY
;
return
STATUS_NO_MEMORY
;
memcpy
(
KeyPath
->
Buffer
,
pathW
,
sizeof
(
pathW
)
);
strcpy
(
buffer
,
"
\\
Registry
\\
User
\\
"
);
ntdll_umbstowcs
(
0
,
user
,
strlen
(
user
)
+
1
,
KeyPath
->
Buffer
+
sizeof
(
pathW
)
/
sizeof
(
WCHAR
),
len
);
strcat
(
buffer
,
user
);
return
STATUS_SUCCESS
;
RtlInitAnsiString
(
&
AnsiPath
,
buffer
);
ret
=
RtlAnsiStringToUnicodeString
(
KeyPath
,
&
AnsiPath
,
TRUE
);
RtlFreeAnsiString
(
&
AnsiPath
);
return
ret
;
}
}
/******************************************************************************
/******************************************************************************
...
...
dlls/ntdll/sec.c
View file @
c4effa39
...
@@ -1178,17 +1178,22 @@ NTSTATUS WINAPI RtlConvertSidToUnicodeString(
...
@@ -1178,17 +1178,22 @@ NTSTATUS WINAPI RtlConvertSidToUnicodeString(
PSID
Sid
,
PSID
Sid
,
BOOLEAN
AllocateString
)
BOOLEAN
AllocateString
)
{
{
const
char
*
p
=
wine_get_user_name
();
const
char
*
user
=
wine_get_user_name
();
NTSTATUS
status
;
int
len
=
ntdll_umbstowcs
(
0
,
user
,
strlen
(
user
)
+
1
,
NULL
,
0
)
*
sizeof
(
WCHAR
);
ANSI_STRING
AnsiStr
;
FIXME
(
"(%p %p %u)
\n
"
,
String
,
Sid
,
AllocateString
);
FIXME
(
"(%p %p %u)
\n
"
,
String
,
Sid
,
AllocateString
);
RtlInitAnsiString
(
&
AnsiStr
,
p
);
String
->
Length
=
len
-
sizeof
(
WCHAR
);
status
=
RtlAnsiStringToUnicodeString
(
String
,
&
AnsiStr
,
AllocateString
);
if
(
AllocateString
)
{
String
->
MaximumLength
=
len
;
if
(
!
(
String
->
Buffer
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
)))
return
STATUS_NO_MEMORY
;
}
else
if
(
len
>
String
->
MaximumLength
)
return
STATUS_BUFFER_OVERFLOW
;
TRACE
(
"%s (%u %u)
\n
"
,
debugstr_w
(
String
->
Buffer
),
String
->
Length
,
String
->
MaximumLength
);
ntdll_umbstowcs
(
0
,
user
,
strlen
(
user
)
+
1
,
String
->
Buffer
,
len
/
sizeof
(
WCHAR
)
);
return
status
;
return
STATUS_SUCCESS
;
}
}
/******************************************************************************
/******************************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment