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.
-- v5: 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.
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..89539d48c0d 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_IMPORT +#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 b06a9628e61..849e72ef33e 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> @@ -712,4 +712,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 | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 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..32e165656d8 --- /dev/null +++ b/include/specstrings_strict.h @@ -0,0 +1,39 @@ +/* + * + * + * 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 !defined(__midl) && !defined(__WIDL__) && (__SPECSTRINGS_STRICT_LEVEL > 0) + +#define __field_bcount(size) +#define __field_ecount(size) +#define __field_xcount(size) + +#define __reserved +#define __success(status) +#define __range(lb,ub) + +#if defined(_MSC_VER) +#define __in +#define __out +#endif + +#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 849e72ef33e..09986ad13ac 100644 --- a/include/ntsecapi.h +++ b/include/ntsecapi.h @@ -188,7 +188,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;
Jacek Caban (@jacek) commented about include/specstrings_strict.h:
+/*
Please add a copyright line. Other than that it looks good to me now, thanks.