Commit 985dd537 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Store the symlink target directly into the correct buffer in…

kernel32: Store the symlink target directly into the correct buffer in GetVolumeNameForVolumeMountPointW.
parent 71f4b3bb
...@@ -797,7 +797,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR ...@@ -797,7 +797,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR
WCHAR *p; WCHAR *p;
char *r; char *r;
DWORD i, i_size = 1024, o_size = 1024; DWORD i, i_size = 1024, o_size = 1024;
WCHAR nonpersist_name[200]; WCHAR *nonpersist_name;
WCHAR symlink_name[MAX_PATH]; WCHAR symlink_name[MAX_PATH];
NTSTATUS status; NTSTATUS status;
HANDLE mgr = INVALID_HANDLE_VALUE; HANDLE mgr = INVALID_HANDLE_VALUE;
...@@ -846,8 +846,8 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR ...@@ -846,8 +846,8 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR
/* Take the mount point and get the "nonpersistent name" */ /* Take the mount point and get the "nonpersistent name" */
/* We will then take that and get the volume name */ /* We will then take that and get the volume name */
status = read_nt_symlink( symlink_name, nonpersist_name, nonpersist_name = (WCHAR *)(input + 1);
sizeof(nonpersist_name)/sizeof(WCHAR) ); status = read_nt_symlink( symlink_name, nonpersist_name, i_size - sizeof(*input) );
TRACE("read_nt_symlink got stat=%x, for %s, got <%s>\n", status, TRACE("read_nt_symlink got stat=%x, for %s, got <%s>\n", status,
debugstr_w(symlink_name), debugstr_w(nonpersist_name)); debugstr_w(symlink_name), debugstr_w(nonpersist_name));
if (status != STATUS_SUCCESS) if (status != STATUS_SUCCESS)
...@@ -862,7 +862,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR ...@@ -862,7 +862,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR
memset( input, 0, sizeof(*input) ); /* clear all input parameters */ memset( input, 0, sizeof(*input) ); /* clear all input parameters */
input->DeviceNameOffset = sizeof(*input); input->DeviceNameOffset = sizeof(*input);
input->DeviceNameLength = lstrlenW( nonpersist_name) * sizeof(WCHAR); input->DeviceNameLength = lstrlenW( nonpersist_name) * sizeof(WCHAR);
memcpy( input + 1, nonpersist_name, input->DeviceNameLength ); i_size = input->DeviceNameOffset + input->DeviceNameLength;
output->Size = o_size; output->Size = o_size;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment