Merge pull request #1199 from hardening/cpp_fixes

Fix winpr headers for C++ usage
This commit is contained in:
Marc-André Moreau 2013-04-29 11:04:28 -07:00
commit 90645418f5
32 changed files with 278 additions and 2 deletions

View File

@ -23,6 +23,10 @@
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned char ASN1uint8_t;
typedef signed char ASN1int8_t;
@ -304,6 +308,7 @@ enum
ASN1DECODE_NOASSERT = ASN1FLAGS_NOASSERT,
};
WINPR_API ASN1module_t ASN1_CreateModule(ASN1uint32_t nVersion, ASN1encodingrule_e eRule,
ASN1uint32_t dwFlags, ASN1uint32_t cPDU, const ASN1GenericFun_t apfnEncoder[],
const ASN1GenericFun_t apfnDecoder[], const ASN1FreeFun_t apfnFreeMemory[],
@ -501,5 +506,9 @@ WINPR_API int ASN1DEREncNewBlkElement(void* pBlk, ASN1encoding_t* enc2);
WINPR_API int ASN1DEREncFlushBlkElement(void* pBlk);
WINPR_API int ASN1DEREncEndBlk(void* pBlk);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_ASN1_H */

View File

@ -83,6 +83,10 @@ typedef PVOID BCRYPT_SECRET_HANDLE;
#define BCRYPT_PRIMITIVE_TYPE L"PrimitiveType"
#define BCRYPT_IS_KEYED_HASH L"IsKeyedHash"
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API NTSTATUS BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE* phAlgorithm,
LPCWSTR pszAlgId, LPCWSTR pszImplementation, ULONG dwFlags);
@ -122,4 +126,7 @@ WINPR_API NTSTATUS BCryptDecrypt(BCRYPT_KEY_HANDLE hKey, PUCHAR pbInput, ULONG c
VOID* pPaddingInfo, PUCHAR pbIV, ULONG cbIV, PUCHAR pbOutput,
ULONG cbOutput, ULONG* pcbResult, ULONG dwFlags);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_BCRYPT_MEMORY_H */

View File

@ -123,6 +123,10 @@ typedef int (*COMMAND_LINE_PRE_FILTER_FN_W)(void* context, int index, int argc,
typedef int (*COMMAND_LINE_POST_FILTER_FN_A)(void* context, COMMAND_LINE_ARGUMENT_A* arg);
typedef int (*COMMAND_LINE_POST_FILTER_FN_W)(void* context, COMMAND_LINE_ARGUMENT_W* arg);
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API int CommandLineClearArgumentsA(COMMAND_LINE_ARGUMENT_A* options);
WINPR_API int CommandLineClearArgumentsW(COMMAND_LINE_ARGUMENT_W* options);
@ -136,6 +140,10 @@ WINPR_API COMMAND_LINE_ARGUMENT_W* CommandLineFindArgumentW(COMMAND_LINE_ARGUMEN
WINPR_API COMMAND_LINE_ARGUMENT_A* CommandLineFindNextArgumentA(COMMAND_LINE_ARGUMENT_A* argument);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define CommandLineClearArguments CommandLineClearArgumentsW
#define CommandLineParseArguments CommandLineParseArgumentsW

View File

@ -30,6 +30,10 @@
#include <winpr/synch.h>
#include <winpr/stream.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef void* (*OBJECT_NEW_FN)(void);
typedef void (*OBJECT_FREE_FN)(void* obj);
typedef void (*OBJECT_EQUALS_FN)(void* objA, void* objB);
@ -335,4 +339,7 @@ WINPR_API void MessagePipe_PostQuit(wMessagePipe* pipe, int nExitCode);
WINPR_API wMessagePipe* MessagePipe_New(void);
WINPR_API void MessagePipe_Free(wMessagePipe* pipe);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_COLLECTIONS_H */

View File

@ -167,6 +167,10 @@ typedef enum _CRED_PROTECTION_TYPE
#define PCREDENTIAL_TARGET_INFORMATION PCREDENTIAL_TARGET_INFORMATIONA
#endif
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API BOOL CredWriteW(PCREDENTIALW Credential, DWORD Flags);
WINPR_API BOOL CredWriteA(PCREDENTIALA Credential, DWORD Flags);
@ -220,6 +224,10 @@ WINPR_API BOOL CredGetSessionTypes(DWORD MaximumPersistCount, LPDWORD MaximumPer
WINPR_API VOID CredFree(PVOID Buffer);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define CredWrite CredWriteW
#define CredRead CredReadW

View File

@ -96,6 +96,10 @@ typedef struct _CREDUI_INFOW
#define PCREDUI_INFO PCREDUI_INFOA
#endif
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API DWORD CredUIPromptForCredentialsW(PCREDUI_INFOW pUiInfo, PCWSTR pszTargetName,
PCtxtHandle pContext, DWORD dwAuthError, PWSTR pszUserName, ULONG ulUserNameBufferSize,
PWSTR pszPassword, ULONG ulPasswordBufferSize, BOOL* save, DWORD dwFlags);
@ -122,6 +126,10 @@ WINPR_API DWORD CredUIStoreSSOCredA(PCSTR pszRealm, PCSTR pszUsername, PCSTR psz
WINPR_API DWORD CredUIReadSSOCredW(PCWSTR pszRealm, PWSTR* ppszUsername);
WINPR_API DWORD CredUIReadSSOCredA(PCSTR pszRealm, PSTR* ppszUsername);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define CredUIPromptForCredentials CredUIPromptForCredentialsW
#define CredUIParseUserName CredUIParseUserNameW

View File

@ -44,6 +44,10 @@ typedef int errno_t;
#define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A)
#define _ARRAYSIZE(A) RTL_NUMBER_OF_V1(A)
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API void* _aligned_malloc(size_t size, size_t alignment);
WINPR_API void* _aligned_realloc(void* memblock, size_t size, size_t alignment);
WINPR_API void* _aligned_recalloc(void* memblock, size_t num, size_t size, size_t alignment);
@ -65,6 +69,11 @@ WINPR_API errno_t _itoa_s(int value, char* buffer, size_t sizeInCharacters, int
WINPR_API errno_t memmove_s(void* dest, size_t numberOfElements, const void* src, size_t count);
WINPR_API errno_t wmemmove_s(WCHAR* dest, size_t numberOfElements, const WCHAR* src, size_t count);
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_CRT_H */

View File

@ -365,6 +365,10 @@ WINPR_API BOOL CertCloseStore(HCERTSTORE hCertStore, DWORD dwFlags);
#define CertOpenSystemStore CertOpenSystemStoreA
#endif
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API PCCERT_CONTEXT CertFindCertificateInStore(HCERTSTORE hCertStore, DWORD dwCertEncodingType,
DWORD dwFindFlags, DWORD dwFindType, const void* pvFindPara, PCCERT_CONTEXT pPrevCertContext);
@ -375,6 +379,10 @@ DWORD CertGetNameStringW(PCCERT_CONTEXT pCertContext, DWORD dwType,
DWORD CertGetNameStringA(PCCERT_CONTEXT pCertContext, DWORD dwType,
DWORD dwFlags, void* pvTypePara, LPSTR pszNameString, DWORD cchNameString);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define CertGetNameString CertGetNameStringW
#else

View File

@ -93,6 +93,10 @@ typedef struct
PDS_NAME_RESULT_ITEM rItems;
} DS_NAME_RESULT, *PDS_NAME_RESULT;
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API DWORD DsCrackSpnW(LPCWSTR pszSpn, DWORD* pcServiceClass, LPWSTR ServiceClass, DWORD* pcServiceName,
LPWSTR ServiceName, DWORD* pcInstanceName, LPWSTR InstanceName, USHORT* pInstancePort);
@ -111,6 +115,10 @@ WINPR_API DWORD DsMakeSpnW(LPCWSTR ServiceClass, LPCWSTR ServiceName, LPCWSTR In
WINPR_API DWORD DsMakeSpnA(LPCSTR ServiceClass, LPCSTR ServiceName, LPCSTR InstanceName,
USHORT InstancePort, LPCSTR Referrer, DWORD* pcSpnLength, LPSTR pszSpn);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define DsMakeSpn DsMakeSpnW
#else

View File

@ -25,6 +25,10 @@
#ifndef _WIN32
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API DWORD GetCurrentDirectoryA(DWORD nBufferLength, LPSTR lpBuffer);
WINPR_API DWORD GetCurrentDirectoryW(DWORD nBufferLength, LPWSTR lpBuffer);
@ -62,6 +66,11 @@ WINPR_API DWORD ExpandEnvironmentStringsW(LPCWSTR lpSrc, LPWSTR lpDst, DWORD nSi
WINPR_API BOOL FreeEnvironmentStringsA(LPCH lpszEnvironmentBlock);
WINPR_API BOOL FreeEnvironmentStringsW(LPWCH lpszEnvironmentBlock);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define GetCurrentDirectory GetCurrentDirectoryW
#define SetCurrentDirectory SetCurrentDirectoryW

View File

@ -194,6 +194,10 @@ typedef VOID (*LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode, DWORD dwNumbe
#define LPWIN32_FIND_DATA LPWIN32_FIND_DATAA
#endif
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
@ -260,6 +264,10 @@ WINPR_API BOOL FindClose(HANDLE hFindFile);
WINPR_API BOOL CreateDirectoryA(LPCSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
WINPR_API BOOL CreateDirectoryW(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define CreateFile CreateFileW
#define DeleteFile DeleteFileW
@ -287,8 +295,16 @@ WINPR_API BOOL CreateDirectoryW(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecu
#define WILDCARD_DOS_QM 0x00000120
#define WILDCARD_DOS_DOT 0x00000140
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API BOOL FilePatternMatchA(LPCSTR lpFileName, LPCSTR lpPattern);
WINPR_API LPSTR FilePatternFindNextWildcardA(LPCSTR lpPattern, DWORD* pFlags);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_FILE_H */

View File

@ -36,6 +36,10 @@
#define HANDLE_TYPE_NAMED_PIPE 6
#define HANDLE_TYPE_ANONYMOUS_PIPE 7
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API HANDLE winpr_Handle_Insert(ULONG Type, PVOID Object);
WINPR_API BOOL winpr_Handle_Remove(HANDLE handle);
@ -58,5 +62,9 @@ WINPR_API BOOL SetHandleInformation(HANDLE hObject, DWORD dwMask, DWORD dwFlags)
#endif
#ifdef __cplusplus
}
#endif
#endif /* WINPR_HANDLE_H */

View File

@ -33,11 +33,19 @@
#define HEAP_ZERO_MEMORY 0x00000008
#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API HANDLE GetProcessHeap(void);
WINPR_API LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes);
WINPR_API LPVOID HeapReAlloc(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes);
WINPR_API BOOL HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_HEAP_H */

View File

@ -20,6 +20,7 @@
#ifndef WINPR_INPUT_H
#define WINPR_INPUT_H
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
@ -854,6 +855,10 @@
#define APPLE_VK_DownArrow 0x7D
#define APPLE_VK_UpArrow 0x7E
#ifdef __cplusplus
extern "C" {
#endif
/**
* Functions
*/
@ -870,4 +875,8 @@ WINPR_API DWORD GetVirtualScanCodeFromVirtualKeyCode(DWORD vkcode, DWORD dwKeybo
WINPR_API DWORD GetVirtualKeyCodeFromKeycode(DWORD keycode, DWORD dwFlags);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_INPUT_H */

View File

@ -25,6 +25,10 @@
#include <winpr/wtypes.h>
#include <winpr/platform.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _WIN32
/* workaround for SLIST_ENTRY conflict */
@ -172,5 +176,9 @@ WINPR_API VOID AppendTailList(PLIST_ENTRY ListHead, PLIST_ENTRY ListToAppend);
WINPR_API VOID PushEntryList(PSINGLE_LIST_ENTRY ListHead, PSINGLE_LIST_ENTRY Entry);
WINPR_API PSINGLE_LIST_ENTRY PopEntryList(PSINGLE_LIST_ENTRY ListHead);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_INTERLOCKED_H */

View File

@ -49,6 +49,10 @@ typedef struct _OVERLAPPED_ENTRY
DWORD dwNumberOfBytesTransferred;
} OVERLAPPED_ENTRY, *LPOVERLAPPED_ENTRY;
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API BOOL GetOverlappedResult(HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, BOOL bWait);
WINPR_API BOOL GetOverlappedResultEx(HANDLE hFile, LPOVERLAPPED lpOverlapped, LPDWORD lpNumberOfBytesTransferred, DWORD dwMilliseconds, BOOL bAlertable);
@ -72,6 +76,10 @@ WINPR_API BOOL CancelIoEx(HANDLE hFile, LPOVERLAPPED lpOverlapped);
WINPR_API BOOL CancelSynchronousIo(HANDLE hThread);
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_IO_H */

View File

@ -32,6 +32,10 @@ typedef HANDLE DLL_DIRECTORY_COOKIE;
#define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
#define LOAD_LIBRARY_SEARCH_USER_DIRS 0x00000400
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API DLL_DIRECTORY_COOKIE AddDllDirectory(PCWSTR NewDirectory);
WINPR_API BOOL RemoveDllDirectory(DLL_DIRECTORY_COOKIE Cookie);
WINPR_API BOOL SetDefaultDllDirectories(DWORD DirectoryFlags);
@ -54,6 +58,10 @@ WINPR_API FARPROC GetProcAddress(HMODULE hModule, LPCSTR lpProcName);
WINPR_API BOOL FreeLibrary(HMODULE hLibModule);
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_LIBRARY_H */

View File

@ -22,6 +22,10 @@
#include <winpr/rpc.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _WIN32
WINPR_API void* MIDL_user_allocate(size_t cBytes);
@ -29,4 +33,8 @@ WINPR_API void MIDL_user_free(void* p);
#endif
#ifdef __cplusplus
}
#endif
#endif /* WINPR_RPC_MIDL_H */

View File

@ -523,8 +523,16 @@ typedef void (*NDR_TYPE_MARSHALL_ROUTINE)(PMIDL_STUB_MESSAGE pStubMsg, unsigned
typedef void (*NDR_TYPE_UNMARSHALL_ROUTINE)(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, unsigned char FormatChar);
typedef void (*NDR_TYPE_FREE_ROUTINE)(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat);
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API CLIENT_CALL_RETURN NdrClientCall2(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ...);
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_RPC_NDR_H */

View File

@ -26,6 +26,10 @@
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API BYTE* NTOWFv1W(LPWSTR Password, UINT32 PasswordLength, BYTE* NtHash);
WINPR_API BYTE* NTOWFv1A(LPSTR Password, UINT32 PasswordLength, BYTE* NtHash);
@ -39,6 +43,10 @@ WINPR_API BYTE* NTOWFv2FromHashW(BYTE* NtHashV1, LPWSTR User, UINT32 UserLength,
WINPR_API BYTE* NTOWFv2FromHashA(BYTE* NtHashV1, LPSTR User, UINT32 UserLength,
LPSTR Domain, UINT32 DomainLength, BYTE* NtHash);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define NTOWFv1 NTOWFv1W
#define NTOWFv2 NTOWFv2W

View File

@ -33,6 +33,10 @@
#else
#ifdef __cplusplus
extern "C" {
#endif
#define PATHCCH_ALLOW_LONG_PATHS 0x00000001 /* Allow building of \\?\ paths if longer than MAX_PATH */
#define VOLUME_PREFIX _T("\\\\?\\Volume")
@ -111,6 +115,7 @@ WINPR_API HRESULT PathCchStripPrefixW(PWSTR pszPath, size_t cchPath);
WINPR_API HRESULT PathCchRemoveFileSpecA(PSTR pszPath, size_t cchPath);
WINPR_API HRESULT PathCchRemoveFileSpecW(PWSTR pszPath, size_t cchPath);
#ifdef UNICODE
#define PathCchAddBackslash PathCchAddBackslashW
#define PathCchRemoveBackslash PathCchRemoveBackslashW
@ -248,6 +253,10 @@ WINPR_API PCWSTR PathGetSharedLibraryExtensionW(unsigned long dwFlags);
#define PathGetSharedLibraryExtension PathGetSharedLibraryExtensionA
#endif
#ifdef __cplusplus
}
#endif
#endif
/**
@ -261,6 +270,10 @@ WINPR_API PCWSTR PathGetSharedLibraryExtensionW(unsigned long dwFlags);
#define KNOWN_PATH_XDG_CACHE_HOME 5
#define KNOWN_PATH_XDG_RUNTIME_DIR 6
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API char* GetKnownPath(int id);
WINPR_API char* GetKnownSubPath(int id, char* path);
WINPR_API char* GetCombinedPath(char* basePath, char* subPath);
@ -270,6 +283,10 @@ WINPR_API char* GetCombinedPath(char* basePath, char* subPath);
WINPR_API BOOL PathFileExistsA(LPCSTR pszPath);
WINPR_API BOOL PathFileExistsW(LPCWSTR pszPath);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define PathFileExists PathFileExistsW
#else

View File

@ -28,8 +28,16 @@
#ifndef _WIN32
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API BOOL CreatePipe(PHANDLE hReadPipe, PHANDLE hWritePipe, LPSECURITY_ATTRIBUTES lpPipeAttributes, DWORD nSize);
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_PIPE_H */

View File

@ -152,6 +152,10 @@ typedef VOID (*PTP_WIN32_IO_CALLBACK)(PTP_CALLBACK_INSTANCE Instance, PVOID Cont
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Synch */
@ -225,4 +229,8 @@ WINPR_API VOID DisassociateCurrentThreadFromCallback(PTP_CALLBACK_INSTANCE pci);
WINPR_API void winpr_pool_dummy(void);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_POOL_H */

View File

@ -25,8 +25,16 @@
#define WINPR_HEXDUMP_LINE_LENGTH 16
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API void winpr_HexDump(BYTE* data, int length);
WINPR_API int wprintfx(const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_UTILS_PRINT_H */

View File

@ -28,6 +28,10 @@
#else
#ifdef __cplusplus
extern "C" {
#endif
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
@ -402,6 +406,10 @@ WINPR_API LONG RegUnLoadKeyA(HKEY hKey, LPCSTR lpSubKey);
#define RegUnLoadKey RegUnLoadKeyA
#endif
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_REGISTRY_H */

View File

@ -445,6 +445,10 @@ typedef struct _RPC_BINDING_HANDLE_TEMPLATE
#include <winpr/ndr.h>
#include <winpr/midl.h>
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API RPC_STATUS RpcBindingCopy(RPC_BINDING_HANDLE SourceBinding, RPC_BINDING_HANDLE* DestinationBinding);
WINPR_API RPC_STATUS RpcBindingFree(RPC_BINDING_HANDLE* Binding);
WINPR_API RPC_STATUS RpcBindingSetOption(RPC_BINDING_HANDLE hBinding, unsigned long option, ULONG_PTR optionValue);
@ -601,6 +605,10 @@ WINPR_API RPC_STATUS RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN Authori
WINPR_API RPC_STATUS RpcServerInqBindingHandle(RPC_BINDING_HANDLE* Binding);
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_RPC_H */

View File

@ -43,6 +43,10 @@ struct winpr_sam_entry
};
typedef struct winpr_sam_entry WINPR_SAM_ENTRY;
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API WINPR_SAM_ENTRY* SamLookupUserA(WINPR_SAM* sam, LPSTR User, UINT32 UserLength, LPSTR Domain, UINT32 DomainLength);
WINPR_API WINPR_SAM_ENTRY* SamLookupUserW(WINPR_SAM* sam, LPWSTR User, UINT32 UserLength, LPWSTR Domain, UINT32 DomainLength);
@ -51,5 +55,9 @@ WINPR_API void SamFreeEntry(WINPR_SAM* sam, WINPR_SAM_ENTRY* entry);
WINPR_API WINPR_SAM* SamOpen(BOOL read_only);
WINPR_API void SamClose(WINPR_SAM* sam);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_UTILS_SAM_H */

View File

@ -930,6 +930,10 @@ typedef PSecurityFunctionTableW (SEC_ENTRY * INIT_SECURITY_INTERFACE_W)(void);
#define INIT_SECURITY_INTERFACE INIT_SECURITY_INTERFACE_A
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Package Management */
WINPR_API SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(ULONG* pcPackages, PSecPkgInfoA* ppPackageInfo);
@ -992,6 +996,15 @@ WINPR_API SECURITY_STATUS SEC_ENTRY EncryptMessage(PCtxtHandle phContext, ULONG
WINPR_API SECURITY_STATUS SEC_ENTRY MakeSignature(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo);
WINPR_API SECURITY_STATUS SEC_ENTRY VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
#ifdef __cplusplus
}
#endif
#endif // WINPR_SSPI
#ifdef __cplusplus
extern "C" {
#endif
/* Custom API */
@ -1005,4 +1018,8 @@ WINPR_API void sspi_SecBufferFree(PSecBuffer SecBuffer);
WINPR_API void sspi_SetAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, char* user, char* domain, char* password);
WINPR_API void sspi_CopyAuthIdentity(SEC_WINNT_AUTH_IDENTITY* identity, SEC_WINNT_AUTH_IDENTITY* srcIdentity);
#ifdef __cplusplus
}
#endif
#endif /* WINPR_SSPI_H */

View File

@ -75,9 +75,17 @@ typedef enum
} EXTENDED_NAME_FORMAT, *PEXTENDED_NAME_FORMAT;
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API BOOL GetUserNameExA(EXTENDED_NAME_FORMAT NameFormat, LPSTR lpNameBuffer, PULONG nSize);
WINPR_API BOOL GetUserNameExW(EXTENDED_NAME_FORMAT NameFormat, LPWSTR lpNameBuffer, PULONG nSize);
#ifdef __cplusplus
}
#endif
#ifdef UNICODE
#define GetUserNameEx GetUserNameExW
#else

View File

@ -335,8 +335,8 @@ WINPR_API void stream_extend(wStream* stream, int request_size);
_src->pointer += _n; \
} while (0)
static INLINE BOOL stream_skip(wStream* s, int sz) {
if ((int) stream_get_left(s) < sz)
static INLINE BOOL stream_skip(wStream* s, size_t sz) {
if (stream_get_left(s) < sz)
return FALSE;
stream_seek(s, sz);
return TRUE;

View File

@ -26,6 +26,10 @@
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _WIN32
#define PROCESSOR_ARCHITECTURE_INTEL 0
@ -310,4 +314,8 @@ WINPR_API BOOL IsProcessorFeaturePresentEx(DWORD ProcessorFeature);
#define PF_SSE_INSTRUCTIONS_AVAILABLE PF_XMMI_INSTRUCTIONS_AVAILABLE
#define PF_SSE2_INSTRUCTIONS_AVAILABLE PF_XMMI64_INSTRUCTIONS_AVAILABLE
#ifdef __cplusplus
}
#endif
#endif /* WINPR_SYSINFO_H */

View File

@ -593,6 +593,10 @@ typedef struct
#define WINHTTP_ERROR_LAST (WINHTTP_ERROR_BASE + 186)
#ifdef __cplusplus
extern "C" {
#endif
WINPR_API BOOL WinHttpTimeFromSystemTime(const SYSTEMTIME* pst, LPWSTR pwszTime);
WINPR_API BOOL WinHttpTimeToSystemTime(LPCWSTR pwszTime, SYSTEMTIME* pst);
@ -651,6 +655,10 @@ WINPR_API BOOL WinHttpGetProxyForUrl(HINTERNET hSession, LPCWSTR lpcwszUrl,
WINPR_API BOOL WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* pProxyConfig);
#ifdef __cplusplus
}
#endif
#endif
#endif /* WINPR_WINHTTP_H */