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
4ab43e28
Commit
4ab43e28
authored
Feb 25, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add more tests for DefineDosDevice().
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1f2a7da2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
16 deletions
+63
-16
volume.c
dlls/kernel32/tests/volume.c
+63
-16
No files found.
dlls/kernel32/tests/volume.c
View file @
4ab43e28
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "ntddstor.h"
#include "ntddstor.h"
#include <stdio.h>
#include <stdio.h>
#include "ddk/ntddcdvd.h"
#include "ddk/ntddcdvd.h"
#include "ddk/mountmgr.h"
#include <pshpack1.h>
#include <pshpack1.h>
struct
COMPLETE_DVD_LAYER_DESCRIPTOR
struct
COMPLETE_DVD_LAYER_DESCRIPTOR
...
@@ -105,11 +106,12 @@ static void test_query_dos_deviceA(void)
...
@@ -105,11 +106,12 @@ static void test_query_dos_deviceA(void)
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
}
}
static
void
test_d
efine_dos_deviceA
(
void
)
static
void
test_d
os_devices
(
void
)
{
{
char
buf
[
MAX_PATH
],
buf2
[
400
];
char
drivestr
[
3
];
char
drivestr
[
3
];
char
buf
[
MAX_PATH
]
;
HANDLE
file
;
DWORD
ret
;
BOOL
ret
;
/* Find an unused drive letter */
/* Find an unused drive letter */
drivestr
[
1
]
=
':'
;
drivestr
[
1
]
=
':'
;
...
@@ -123,20 +125,65 @@ static void test_define_dos_deviceA(void)
...
@@ -123,20 +125,65 @@ static void test_define_dos_deviceA(void)
return
;
return
;
}
}
/* Map it to point to the current directory */
ret
=
DefineDosDeviceA
(
0
,
drivestr
,
"C:/windows/"
);
ret
=
GetCurrentDirectoryA
(
sizeof
(
buf
),
buf
);
todo_wine
ok
(
ret
,
"failed to define drive %s, error %u
\n
"
,
drivestr
,
GetLastError
());
ok
(
ret
,
"GetCurrentDir
\n
"
);
ret
=
DefineDosDeviceA
(
0
,
drivestr
,
buf
);
ret
=
QueryDosDeviceA
(
drivestr
,
buf
,
sizeof
(
buf
)
);
todo_wine
todo_wine
ok
(
ret
,
"failed to query drive %s, error %u
\n
"
,
drivestr
,
GetLastError
());
ok
(
ret
,
"Could not make drive %s point to %s!
\n
"
,
drivestr
,
buf
);
todo_wine
ok
(
!
strcmp
(
buf
,
"
\\
??
\\
C:
\\
windows
\\
"
),
"got path %s
\n
"
,
debugstr_a
(
buf
)
);
if
(
!
ret
)
{
sprintf
(
buf
,
"%s/system32"
,
drivestr
);
skip
(
"can't test removing fake drive
\n
"
);
file
=
CreateFileA
(
buf
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
}
else
{
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
);
ret
=
DefineDosDeviceA
(
DDD_REMOVE_DEFINITION
,
drivestr
,
NULL
);
todo_wine
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ret
,
"Could not remove fake drive %s!
\n
"
,
drivestr
);
CloseHandle
(
file
);
}
/* but it's not a volume mount point */
sprintf
(
buf
,
"%s
\\
"
,
drivestr
);
ret
=
GetVolumeNameForVolumeMountPointA
(
buf
,
buf2
,
sizeof
(
buf2
)
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
());
ret
=
DefineDosDeviceA
(
DDD_REMOVE_DEFINITION
,
drivestr
,
NULL
);
todo_wine
ok
(
ret
,
"failed to remove drive %s, error %u
\n
"
,
drivestr
,
GetLastError
());
ret
=
QueryDosDeviceA
(
drivestr
,
buf
,
sizeof
(
buf
)
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"got error %u
\n
"
,
GetLastError
());
sprintf
(
buf
,
"%s/system32"
,
drivestr
);
file
=
CreateFileA
(
buf
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
);
ok
(
file
==
INVALID_HANDLE_VALUE
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_PATH_NOT_FOUND
,
"got error %u
\n
"
,
GetLastError
());
/* try with DDD_RAW_TARGET_PATH */
ret
=
DefineDosDeviceA
(
DDD_RAW_TARGET_PATH
,
drivestr
,
"
\\
??
\\
C:
\\
windows
\\
"
);
ok
(
ret
,
"failed to define drive %s, error %u
\n
"
,
drivestr
,
GetLastError
());
ret
=
QueryDosDeviceA
(
drivestr
,
buf
,
sizeof
(
buf
)
);
todo_wine
ok
(
ret
,
"failed to query drive %s, error %u
\n
"
,
drivestr
,
GetLastError
());
todo_wine
ok
(
!
strcmp
(
buf
,
"
\\
??
\\
C:
\\
windows
\\
"
),
"got path %s
\n
"
,
debugstr_a
(
buf
));
sprintf
(
buf
,
"%s/system32"
,
drivestr
);
file
=
CreateFileA
(
buf
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
);
todo_wine
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"got error %u
\n
"
,
GetLastError
());
CloseHandle
(
file
);
sprintf
(
buf
,
"%s
\\
"
,
drivestr
);
ret
=
GetVolumeNameForVolumeMountPointA
(
buf
,
buf2
,
sizeof
(
buf2
)
);
ok
(
!
ret
,
"expected failure
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
());
ret
=
DefineDosDeviceA
(
DDD_REMOVE_DEFINITION
,
drivestr
,
NULL
);
ok
(
ret
,
"failed to remove drive %s, error %u
\n
"
,
drivestr
,
GetLastError
());
ret
=
QueryDosDeviceA
(
drivestr
,
buf
,
sizeof
(
buf
)
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"got error %u
\n
"
,
GetLastError
());
}
}
static
void
test_FindFirstVolume
(
void
)
static
void
test_FindFirstVolume
(
void
)
...
@@ -1272,7 +1319,7 @@ START_TEST(volume)
...
@@ -1272,7 +1319,7 @@ START_TEST(volume)
pGetVolumePathNamesForVolumeNameW
=
(
void
*
)
GetProcAddress
(
hdll
,
"GetVolumePathNamesForVolumeNameW"
);
pGetVolumePathNamesForVolumeNameW
=
(
void
*
)
GetProcAddress
(
hdll
,
"GetVolumePathNamesForVolumeNameW"
);
test_query_dos_deviceA
();
test_query_dos_deviceA
();
test_d
efine_dos_deviceA
();
test_d
os_devices
();
test_FindFirstVolume
();
test_FindFirstVolume
();
test_GetVolumePathNameA
();
test_GetVolumePathNameA
();
test_GetVolumePathNameW
();
test_GetVolumePathNameW
();
...
...
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