Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
57f92367
Commit
57f92367
authored
Jun 10, 2009
by
Stefan Leichter
Committed by
Alexandre Julliard
Jun 11, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Implement QueryFullProcessImageNameA.
parent
3ea66d60
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
78 additions
and
1 deletion
+78
-1
kernel32.spec
dlls/kernel32/kernel32.spec
+1
-1
process.c
dlls/kernel32/process.c
+21
-0
process.c
dlls/kernel32/tests/process.c
+56
-0
No files found.
dlls/kernel32/kernel32.spec
View file @
57f92367
...
...
@@ -865,7 +865,7 @@
@ stdcall QueryDepthSList(ptr) ntdll.RtlQueryDepthSList
@ stdcall QueryDosDeviceA(str ptr long)
@ stdcall QueryDosDeviceW(wstr ptr long)
@ st
ub QueryFullProcessImageNameA
@ st
dcall QueryFullProcessImageNameA(ptr long ptr ptr)
@ stdcall QueryFullProcessImageNameW(ptr long ptr ptr)
@ stdcall QueryInformationJobObject(long long ptr long ptr)
# @ stub QueryMemoryResourceNotification
...
...
dlls/kernel32/process.c
View file @
57f92367
...
...
@@ -3134,6 +3134,27 @@ BOOL WINAPI GetProcessHandleCount(HANDLE hProcess, DWORD *cnt)
}
/******************************************************************
* QueryFullProcessImageNameA (KERNEL32.@)
*/
BOOL
WINAPI
QueryFullProcessImageNameA
(
HANDLE
hProcess
,
DWORD
dwFlags
,
LPSTR
lpExeName
,
PDWORD
pdwSize
)
{
BOOL
retval
;
DWORD
pdwSizeW
=
*
pdwSize
;
LPWSTR
lpExeNameW
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
*
pdwSize
*
sizeof
(
WCHAR
));
retval
=
QueryFullProcessImageNameW
(
hProcess
,
dwFlags
,
lpExeNameW
,
&
pdwSizeW
);
if
(
retval
)
retval
=
(
0
!=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpExeNameW
,
-
1
,
lpExeName
,
*
pdwSize
,
NULL
,
NULL
));
if
(
retval
)
*
pdwSize
=
strlen
(
lpExeName
);
HeapFree
(
GetProcessHeap
(),
0
,
lpExeNameW
);
return
retval
;
}
/******************************************************************
* QueryFullProcessImageNameW (KERNEL32.@)
*/
BOOL
WINAPI
QueryFullProcessImageNameW
(
HANDLE
hProcess
,
DWORD
dwFlags
,
LPWSTR
lpExeName
,
PDWORD
pdwSize
)
...
...
dlls/kernel32/tests/process.c
View file @
57f92367
...
...
@@ -41,6 +41,12 @@
ok((expected) == value, "Expected " #actual " to be %d (" #expected ") is %d\n", \
(expected), value); \
} while (0)
#define expect_eq_s(expected, actual) \
do { \
LPCSTR value = (actual); \
ok(lstrcmpA((expected), value) == 0, "Expected " #actual " to be L\"%s\" (" #expected ") is L\"%s\"\n", \
expected, value); \
} while (0)
#define expect_eq_ws_i(expected, actual) \
do { \
LPCWSTR value = (actual); \
...
...
@@ -68,6 +74,7 @@ static const char *wine_dbgstr_w(LPCWSTR wstr)
static
HINSTANCE
hkernel32
;
static
LPVOID
(
WINAPI
*
pVirtualAllocEx
)(
HANDLE
,
LPVOID
,
SIZE_T
,
DWORD
,
DWORD
);
static
BOOL
(
WINAPI
*
pVirtualFreeEx
)(
HANDLE
,
LPVOID
,
SIZE_T
,
DWORD
);
static
BOOL
(
WINAPI
*
pQueryFullProcessImageNameA
)(
HANDLE
hProcess
,
DWORD
dwFlags
,
LPSTR
lpExeName
,
PDWORD
lpdwSize
);
static
BOOL
(
WINAPI
*
pQueryFullProcessImageNameW
)(
HANDLE
hProcess
,
DWORD
dwFlags
,
LPWSTR
lpExeName
,
PDWORD
lpdwSize
);
/* ############################### */
...
...
@@ -206,6 +213,7 @@ static int init(void)
hkernel32
=
GetModuleHandleA
(
"kernel32"
);
pVirtualAllocEx
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"VirtualAllocEx"
);
pVirtualFreeEx
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"VirtualFreeEx"
);
pQueryFullProcessImageNameA
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"QueryFullProcessImageNameA"
);
pQueryFullProcessImageNameW
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"QueryFullProcessImageNameW"
);
return
1
;
}
...
...
@@ -1618,6 +1626,53 @@ static void test_GetProcessVersion(void)
CloseHandle
(
pi
.
hThread
);
}
static
void
test_ProcessNameA
(
void
)
{
#define INIT_STR "Just some words"
DWORD
length
,
size
;
CHAR
buf
[
1024
];
if
(
!
pQueryFullProcessImageNameA
)
{
win_skip
(
"QueryFullProcessImageNameA unavailable (added in Windows Vista)
\n
"
);
return
;
}
/* get the buffer length without \0 terminator */
length
=
1024
;
expect_eq_d
(
TRUE
,
pQueryFullProcessImageNameA
(
GetCurrentProcess
(),
0
,
buf
,
&
length
));
expect_eq_d
(
length
,
lstrlenA
(
buf
));
/* when the buffer is too small
* - function fail with error ERROR_INSUFFICIENT_BUFFER
* - the size variable is not modified
* tested with the biggest too small size
*/
size
=
length
;
sprintf
(
buf
,
INIT_STR
);
expect_eq_d
(
FALSE
,
pQueryFullProcessImageNameA
(
GetCurrentProcess
(),
0
,
buf
,
&
size
));
expect_eq_d
(
ERROR_INSUFFICIENT_BUFFER
,
GetLastError
());
expect_eq_d
(
length
,
size
);
expect_eq_s
(
INIT_STR
,
buf
);
/* retest with smaller buffer size
*/
size
=
4
;
sprintf
(
buf
,
INIT_STR
);
expect_eq_d
(
FALSE
,
pQueryFullProcessImageNameA
(
GetCurrentProcess
(),
0
,
buf
,
&
size
));
expect_eq_d
(
ERROR_INSUFFICIENT_BUFFER
,
GetLastError
());
expect_eq_d
(
4
,
size
);
expect_eq_s
(
INIT_STR
,
buf
);
/* this is a difference between the ascii and the unicode version
* the unicode version crashes when the size is big enough to hold the result
* ascii version throughs an error
*/
size
=
1024
;
expect_eq_d
(
FALSE
,
pQueryFullProcessImageNameA
(
GetCurrentProcess
(),
0
,
NULL
,
&
size
));
expect_eq_d
(
1024
,
size
);
expect_eq_d
(
ERROR_INVALID_PARAMETER
,
GetLastError
());
}
static
void
test_ProcessName
(
void
)
{
HANDLE
hSelf
;
...
...
@@ -1741,6 +1796,7 @@ START_TEST(process)
test_ExitCode
();
test_OpenProcess
();
test_GetProcessVersion
();
test_ProcessNameA
();
test_ProcessName
();
test_Handles
();
/* things that can be tested:
...
...
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