I tried build a real Windows application (mimikatz) and had troubles with some wine headers incompatibility. The patch set improves headers to allow build the foreign application with Wine.
-- v2: include: Add standalone LSA_OBJECT_ATTRIBUTES prototype if ntdef.h is not included. include: Add initial activeds.h. include: Add missed PCWCHAR to winnt.h. include: Include ncrypt.h in wincrypt.h. include: Add specstrings_strict.h with some defines. include: Use compatible file guard name (_NTSECAPI_, _NTSECPKG_). include: Add some missed defines. ntdll: Use COMPRESSION_FORMAT_MASK instead of ~COMPRESSION_ENGINE_MAXINUM.
From: Vitaly Lipatov lav@etersoft.ru
--- dlls/ntdll/tests/rtl.c | 1 + include/ddk/ntifs.h | 15 +++++++++++++++ include/winnt.h | 6 ------ 3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 76cecebae34..117d9eed067 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -27,6 +27,7 @@ #include "in6addr.h" #include "inaddr.h" #include "ip2string.h" +#include "ddk/ntifs.h" #include "wine/asm.h"
#ifndef __WINE_WINTERNL_H diff --git a/include/ddk/ntifs.h b/include/ddk/ntifs.h index cedd54a66fe..10df006c4f5 100644 --- a/include/ddk/ntifs.h +++ b/include/ddk/ntifs.h @@ -188,6 +188,21 @@ typedef struct _REPARSE_GUID_DATA_BUFFER
#define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
+#define COMPRESSION_FORMAT_NONE 0 +#define COMPRESSION_FORMAT_DEFAULT 1 +#define COMPRESSION_FORMAT_LZNT1 2 +#define COMPRESSION_FORMAT_XPRESS 3 // Windows 8 +#define COMPRESSION_FORMAT_XPRESS_HUFF 4 // Windows 8 +#define COMPRESSION_FORMAT_MAX 4 + +#define COMPRESSION_ENGINE_STANDARD 0x0000 +#define COMPRESSION_ENGINE_MAXIMUM 0x0100 +#define COMPRESSION_ENGINE_HIBER 0x0200 +#define COMPRESSION_ENGINE_MAX 0x0200 + +#define COMPRESSION_FORMAT_MASK 0x00FF +#define COMPRESSION_ENGINE_MASK 0xFF00 + BOOLEAN WINAPI FsRtlIsNameInExpression(PUNICODE_STRING, PUNICODE_STRING, BOOLEAN, PWCH); DEVICE_OBJECT * WINAPI IoGetAttachedDevice(DEVICE_OBJECT*); PEPROCESS WINAPI IoGetRequestorProcess(IRP*); diff --git a/include/winnt.h b/include/winnt.h index ab14bcc80d5..c04f25b29bd 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -5468,12 +5468,6 @@ typedef struct _QUOTA_LIMITS_EX { #define FILE_256_BYTE_ALIGNMENT 0x000000ff #define FILE_512_BYTE_ALIGNMENT 0x000001ff
-#define COMPRESSION_FORMAT_NONE 0 -#define COMPRESSION_FORMAT_DEFAULT 1 -#define COMPRESSION_FORMAT_LZNT1 2 -#define COMPRESSION_ENGINE_STANDARD 0 -#define COMPRESSION_ENGINE_MAXIMUM 256 - #define MAILSLOT_NO_MESSAGE ((DWORD)-1) #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
From: Vitaly Lipatov lav@etersoft.ru
--- dlls/ntdll/rtl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c index 1eec1962b1e..4cc722836e1 100644 --- a/dlls/ntdll/rtl.c +++ b/dlls/ntdll/rtl.c @@ -1754,7 +1754,7 @@ NTSTATUS WINAPI RtlGetCompressionWorkSpaceSize(USHORT format, PULONG compress_wo { FIXME("0x%04x, %p, %p: semi-stub\n", format, compress_workspace, decompress_workspace);
- switch (format & ~COMPRESSION_ENGINE_MAXIMUM) + switch (format & COMPRESSION_FORMAT_MASK) { case COMPRESSION_FORMAT_LZNT1: if (compress_workspace) @@ -1818,7 +1818,7 @@ NTSTATUS WINAPI RtlCompressBuffer(USHORT format, PUCHAR uncompressed, ULONG unco FIXME("0x%04x, %p, %lu, %p, %lu, %lu, %p, %p: semi-stub\n", format, uncompressed, uncompressed_size, compressed, compressed_size, chunk_size, final_size, workspace);
- switch (format & ~COMPRESSION_ENGINE_MAXIMUM) + switch (format & COMPRESSION_FORMAT_MASK) { case COMPRESSION_FORMAT_LZNT1: return lznt1_compress(uncompressed, uncompressed_size, compressed, @@ -2021,7 +2021,7 @@ NTSTATUS WINAPI RtlDecompressFragment(USHORT format, PUCHAR uncompressed, ULONG TRACE("0x%04x, %p, %lu, %p, %lu, %lu, %p, %p\n", format, uncompressed, uncompressed_size, compressed, compressed_size, offset, final_size, workspace);
- switch (format & ~COMPRESSION_ENGINE_MAXIMUM) + switch (format & COMPRESSION_FORMAT_MASK) { case COMPRESSION_FORMAT_LZNT1: return lznt1_decompress(uncompressed, uncompressed_size, compressed,
From: Vitaly Lipatov lav@etersoft.ru
--- include/lmshare.h | 2 ++ include/msasn1.h | 4 ++++ include/ntstatus.h | 1 + 3 files changed, 7 insertions(+)
diff --git a/include/lmshare.h b/include/lmshare.h index 442cf5ef306..2cb71df4756 100644 --- a/include/lmshare.h +++ b/include/lmshare.h @@ -74,6 +74,8 @@ NET_API_STATUS WINAPI NetShareSetInfo(LMSTR,LMSTR,DWORD,LPBYTE,LPDWORD); #define STYPE_IPC 3 #define STYPE_SPECIAL 0x80000000
+#define SHI_USES_UNLIMITED (DWORD)(-1) + NET_API_STATUS WINAPI NetSessionDel(LMSTR,LMSTR,LMSTR); NET_API_STATUS WINAPI NetSessionEnum(LMSTR,LMSTR,LMSTR,DWORD,LPBYTE*,DWORD,LPDWORD,LPDWORD,LPDWORD); NET_API_STATUS WINAPI NetSessionGetInfo(LMSTR,LMSTR,LMSTR,DWORD,LPBYTE*); diff --git a/include/msasn1.h b/include/msasn1.h index 244ed61487b..1e2f0c9ff3e 100644 --- a/include/msasn1.h +++ b/include/msasn1.h @@ -46,6 +46,10 @@ typedef ASN1uint16_t ASN1choice_t; typedef ASN1uint32_t ASN1magic_t; typedef ASN1ztcharstring_t ASN1objectdescriptor_t;
+#define ASN1_PUBLIC __declspec(dllimport) +#define ASN1API __stdcall +#define ASN1CALL __stdcall + #define ASN1_MAKE_VERSION(major,minor) (((major) << 16) | (minor)) #define ASN1_THIS_VERSION ASN1_MAKE_VERSION(1,0)
diff --git a/include/ntstatus.h b/include/ntstatus.h index e049be0bdbd..15bc7d6668b 100644 --- a/include/ntstatus.h +++ b/include/ntstatus.h @@ -1413,6 +1413,7 @@ #define STATUS_SMI_PRIMITIVE_INSTALLER_FAILED ((NTSTATUS) 0xC0150025) #define STATUS_GENERIC_COMMAND_FAILED ((NTSTATUS) 0xC0150026) #define STATUS_SXS_FILE_HASH_MISSING ((NTSTATUS) 0xC0150027) +#define STATUS_HANDLE_NO_LONGER_VALID ((NTSTATUS) 0xC0190028)
#define STATUS_GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER ((NTSTATUS) 0xC01E0000) #define STATUS_GRAPHICS_INSUFFICIENT_DMA_BUFFER ((NTSTATUS) 0xC01E0001)
From: Vitaly Lipatov lav@etersoft.ru
--- include/ntsecapi.h | 6 +++--- include/ntsecpkg.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/ntsecapi.h b/include/ntsecapi.h index ded31b41e56..0972de7ad16 100644 --- a/include/ntsecapi.h +++ b/include/ntsecapi.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#ifndef __WINE_NTSECAPI_H -#define __WINE_NTSECAPI_H +#ifndef _NTSECAPI_ +#define _NTSECAPI_
#ifndef GUID_DEFINED # include <guiddef.h> @@ -685,4 +685,4 @@ NTSTATUS WINAPI LsaRegisterLogonProcess(PLSA_STRING,PHANDLE,PLSA_OPERATIONAL_MOD } /* extern "C" */ #endif /* defined(__cplusplus) */
-#endif /* !defined(__WINE_NTSECAPI_H) */ +#endif /* !defined(_NTSECAPI_) */ diff --git a/include/ntsecpkg.h b/include/ntsecpkg.h index 99b9ec7d407..539ca2beea3 100644 --- a/include/ntsecpkg.h +++ b/include/ntsecpkg.h @@ -16,8 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#ifndef _NTSECPKG_H -#define _NTSECPKG_H +#ifndef _NTSECPKG_ +#define _NTSECPKG_
#ifdef __cplusplus extern "C" { @@ -511,4 +511,4 @@ typedef NTSTATUS (WINAPI *SpUserModeInitializeFn)(ULONG, PULONG, #ifdef __cplusplus } #endif -#endif /* _NTSECPKG_H */ +#endif /* _NTSECPKG_ */
From: Vitaly Lipatov lav@etersoft.ru
--- include/specstrings.h | 4 ++++ include/specstrings_strict.h | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 include/specstrings_strict.h
diff --git a/include/specstrings.h b/include/specstrings.h index f2636a49779..4d404759c2e 100644 --- a/include/specstrings.h +++ b/include/specstrings.h @@ -323,6 +323,10 @@ extern "C" { #endif #endif
+#ifndef RC_INVOKED +#include <specstrings_strict.h> +#endif /* RC_INVOKED */ + #ifndef DECLSPEC_ADDRSAFE #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64)) #define DECLSPEC_ADDRSAFE __declspec(address_safe) diff --git a/include/specstrings_strict.h b/include/specstrings_strict.h new file mode 100644 index 00000000000..34153f34817 --- /dev/null +++ b/include/specstrings_strict.h @@ -0,0 +1,34 @@ +/* + * + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __SPECSTRINGS_STRICT_LEVEL +#define __SPECSTRINGS_STRICT_LEVEL 1 +#endif + +#if (_MSC_VER >= 1400) && !defined(__midl) && !defined(__WIDL__) && (__SPECSTRINGS_STRICT_LEVEL > 0) + +#define __field_bcount(size) +#define __field_ecount(size) +#define __field_xcount(size) +#define __in +#define __out +#define __reserved +#define __success(status) +#define __range(lb,ub) + +#endif
From: Vitaly Lipatov lav@etersoft.ru
--- include/wincrypt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/wincrypt.h b/include/wincrypt.h index 81ae7d040da..0da94a31f73 100644 --- a/include/wincrypt.h +++ b/include/wincrypt.h @@ -26,7 +26,7 @@ extern "C" { #endif
#include <bcrypt.h> -/* FIXME: #include <ncrypt.h> */ +#include <ncrypt.h>
#ifndef WINADVAPI #ifdef _ADVAPI32_
From: Vitaly Lipatov lav@etersoft.ru
--- include/winnt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/winnt.h b/include/winnt.h index c04f25b29bd..97ff74de247 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -536,7 +536,7 @@ typedef CHAR *PZZSTR; typedef const CHAR *PCZZSTR;
/* Unicode string types */ -typedef const WCHAR *PCWCHAR, *LPCUWCHAR, *PCUWCHAR; +typedef const WCHAR *LPCWCHAR, *PCWCHAR, *LPCUWCHAR, *PCUWCHAR; typedef WCHAR *PWCH, *LPWCH; typedef const WCHAR *PCWCH, *LPCWCH; typedef WCHAR *PNZWCH, *PUNZWCH;
From: Vitaly Lipatov lav@etersoft.ru
--- include/activeds.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/activeds.h
diff --git a/include/activeds.h b/include/activeds.h new file mode 100644 index 00000000000..1cf9e0acfac --- /dev/null +++ b/include/activeds.h @@ -0,0 +1,21 @@ +/* + * Copyright 2023 Vitaly Lipatov + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "iads.h" +#include "adshlp.h" +#include "adserr.h"
From: Vitaly Lipatov lav@etersoft.ru
--- include/ntsecapi.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/include/ntsecapi.h b/include/ntsecapi.h index 0972de7ad16..f48fddf3cb0 100644 --- a/include/ntsecapi.h +++ b/include/ntsecapi.h @@ -180,7 +180,20 @@ typedef struct _SecHandle
typedef UNICODE_STRING LSA_UNICODE_STRING, *PLSA_UNICODE_STRING; typedef STRING LSA_STRING, *PLSA_STRING; + +#ifdef _NTDEF_ typedef OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES; +#else + typedef struct _LSA_OBJECT_ATTRIBUTES { + ULONG Length; + HANDLE RootDirectory; + PLSA_UNICODE_STRING ObjectName; + ULONG Attributes; + PVOID SecurityDescriptor; + PVOID SecurityQualityOfService; + } LSA_OBJECT_ATTRIBUTES,*PLSA_OBJECT_ATTRIBUTES; +#endif +
typedef PVOID LSA_HANDLE, *PLSA_HANDLE; typedef ULONG LSA_ENUMERATION_HANDLE, *PLSA_ENUMERATION_HANDLE;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=135628
Your paranoid android.
=== debian11b (build log) ===
0288:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this. 0288:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this. 0288:err:winediag:d3d_device_create The application wants to create a Direct3D device, but the current DirectDrawRenderer does not support this.
Jacek Caban (@jacek) commented about include/msasn1.h:
typedef ASN1uint32_t ASN1magic_t; typedef ASN1ztcharstring_t ASN1objectdescriptor_t;
+#define ASN1_PUBLIC __declspec(dllimport)
We still need to support non-PE targets, so using __declspec like this is problematic. This should probably just use DECLSPEC_IMPORT.
Jacek Caban (@jacek) commented about include/specstrings_strict.h:
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#ifndef __SPECSTRINGS_STRICT_LEVEL +#define __SPECSTRINGS_STRICT_LEVEL 1 +#endif
+#if (_MSC_VER >= 1400) && !defined(__midl) && !defined(__WIDL__) && (__SPECSTRINGS_STRICT_LEVEL > 0)
This _MSC_VER check is not really optimal. Since you define those macros to nothing, there is no need for features checks and we want as many of them as possible to be available on other targets.
The problematic part thing about __in/__out is that GCC's libstdc++, which still uses those as variable names. I guess we could guard only those problematic macros with _MSC_VER.