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
5742497a
Commit
5742497a
authored
Jun 08, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Some tests for invalid classes in SetFileInformationByHandle().
parent
b95d3184
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
0 deletions
+90
-0
file.c
dlls/kernel32/tests/file.c
+59
-0
winbase.h
include/winbase.h
+31
-0
No files found.
dlls/kernel32/tests/file.c
View file @
5742497a
...
...
@@ -55,6 +55,7 @@ static NTSTATUS (WINAPI *pNtCreateFile)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES
PLARGE_INTEGER
,
ULONG
,
ULONG
,
ULONG
,
ULONG
,
PVOID
,
ULONG
);
static
BOOL
(
WINAPI
*
pRtlDosPathNameToNtPathName_U
)(
LPCWSTR
,
PUNICODE_STRING
,
PWSTR
*
,
CURDIR
*
);
static
NTSTATUS
(
WINAPI
*
pRtlAnsiStringToUnicodeString
)(
PUNICODE_STRING
,
PCANSI_STRING
,
BOOLEAN
);
static
BOOL
(
WINAPI
*
pSetFileInformationByHandle
)(
HANDLE
,
FILE_INFO_BY_HANDLE_CLASS
,
void
*
,
DWORD
);
static
const
char
filename
[]
=
"testfile.xxx"
;
static
const
char
sillytext
[]
=
...
...
@@ -99,6 +100,7 @@ static void InitFunctionPointers(void)
pCreateFile2
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"CreateFile2"
);
pGetFinalPathNameByHandleA
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"GetFinalPathNameByHandleA"
);
pGetFinalPathNameByHandleW
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"GetFinalPathNameByHandleW"
);
pSetFileInformationByHandle
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"SetFileInformationByHandle"
);
}
static
void
test__hread
(
void
)
...
...
@@ -4581,6 +4583,62 @@ static void test_GetFinalPathNameByHandleW(void)
CloseHandle
(
file
);
}
static
void
test_SetFileInformationByHandle
(
void
)
{
FILE_ATTRIBUTE_TAG_INFO
fileattrinfo
=
{
0
};
FILE_REMOTE_PROTOCOL_INFO
protinfo
=
{
0
};
FILE_STANDARD_INFO
stdinfo
=
{
};
FILE_COMPRESSION_INFO
compressinfo
;
char
tempFileName
[
MAX_PATH
];
char
tempPath
[
MAX_PATH
];
HANDLE
file
;
BOOL
ret
;
if
(
!
pSetFileInformationByHandle
)
{
win_skip
(
"SetFileInformationByHandle is not supported
\n
"
);
return
;
}
ret
=
GetTempPathA
(
sizeof
(
tempPath
),
tempPath
);
ok
(
ret
,
"GetTempPathA failed, got error %u.
\n
"
,
GetLastError
());
/* ensure the existence of a file in the temp folder */
ret
=
GetTempFileNameA
(
tempPath
,
"abc"
,
0
,
tempFileName
);
ok
(
ret
,
"GetTempFileNameA failed, got error %u.
\n
"
,
GetLastError
());
file
=
CreateFileA
(
tempFileName
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_DELETE_ON_CLOSE
,
NULL
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"failed to open the temp file, error %u.
\n
"
,
GetLastError
());
/* invalid classes */
SetLastError
(
0xdeadbeef
);
ret
=
pSetFileInformationByHandle
(
file
,
FileStandardInfo
,
&
stdinfo
,
sizeof
(
stdinfo
));
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got %d, error %d
\n
"
,
ret
,
GetLastError
());
memset
(
&
compressinfo
,
0
,
sizeof
(
compressinfo
));
SetLastError
(
0xdeadbeef
);
ret
=
pSetFileInformationByHandle
(
file
,
FileCompressionInfo
,
&
compressinfo
,
sizeof
(
compressinfo
));
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got %d, error %d
\n
"
,
ret
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pSetFileInformationByHandle
(
file
,
FileAttributeTagInfo
,
&
fileattrinfo
,
sizeof
(
fileattrinfo
));
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got %d, error %d
\n
"
,
ret
,
GetLastError
());
memset
(
&
protinfo
,
0
,
sizeof
(
protinfo
));
protinfo
.
StructureVersion
=
1
;
protinfo
.
StructureSize
=
sizeof
(
protinfo
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetFileInformationByHandle
(
file
,
FileRemoteProtocolInfo
,
&
protinfo
,
sizeof
(
protinfo
));
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got %d, error %d
\n
"
,
ret
,
GetLastError
());
CloseHandle
(
file
);
}
START_TEST
(
file
)
{
InitFunctionPointers
();
...
...
@@ -4636,4 +4694,5 @@ START_TEST(file)
test_file_access
();
test_GetFinalPathNameByHandleA
();
test_GetFinalPathNameByHandleW
();
test_SetFileInformationByHandle
();
}
include/winbase.h
View file @
5742497a
...
...
@@ -874,6 +874,37 @@ typedef struct _FILE_RENAME_INFO {
WCHAR
FileName
[
1
];
}
FILE_RENAME_INFO
,
*
PFILE_RENAME_INFO
;
typedef
struct
_FILE_ATTRIBUTE_TAG_INFO
{
DWORD
FileAttributes
;
DWORD
ReparseTag
;
}
FILE_ATTRIBUTE_TAG_INFO
,
*
PFILE_ATTRIBUTE_TAG_INFO
;
typedef
struct
_FILE_COMPRESSION_INFO
{
LARGE_INTEGER
CompressedFileSize
;
WORD
CompressionFormat
;
UCHAR
CompressionUnitShift
;
UCHAR
ChunkShift
;
UCHAR
ClusterShift
;
UCHAR
Reserved
[
3
];
}
FILE_COMPRESSION_INFO
,
*
PFILE_COMPRESSION_INFO
;
typedef
struct
_FILE_REMOTE_PROTOCOL_INFO
{
USHORT
StructureVersion
;
USHORT
StructureSize
;
ULONG
Protocol
;
USHORT
ProtocolMajorVersion
;
USHORT
ProtocolMinorVersion
;
USHORT
ProtocolRevision
;
USHORT
Reserved
;
ULONG
Flags
;
struct
{
ULONG
Reserved
[
8
];
}
GenericReserved
;
struct
{
ULONG
Reserved
[
16
];
}
ProtocolSpecificReserved
;
}
FILE_REMOTE_PROTOCOL_INFO
,
*
PFILE_REMOTE_PROTOCOL_INFO
;
#define PIPE_ACCESS_INBOUND 1
#define PIPE_ACCESS_OUTBOUND 2
#define PIPE_ACCESS_DUPLEX 3
...
...
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