mirror of
https://github.com/UzixLS/KernelEx.git
synced 2025-07-19 07:21:20 +03:00
import KernelEx-4.0-RC1
This commit is contained in:
28
apilibs/kexbases/Advapi32/RegDisablePredefinedCache.c
Normal file
28
apilibs/kexbases/Advapi32/RegDisablePredefinedCache.c
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT RegDisablePredefinedCache_new=RegDisablePredefinedCache */
|
||||
BOOL WINAPI RegDisablePredefinedCache_new()
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
28
apilibs/kexbases/Advapi32/RegOpenCurrentUser.c
Normal file
28
apilibs/kexbases/Advapi32/RegOpenCurrentUser.c
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT RegOpenCurrentUser_new=RegOpenCurrentUser */
|
||||
LONG WINAPI RegOpenCurrentUser_new(REGSAM access, PHKEY retkey)
|
||||
{
|
||||
return RegOpenKeyExA(HKEY_CURRENT_USER, NULL, 0, access, retkey);
|
||||
}
|
34
apilibs/kexbases/Advapi32/TraceMessage.c
Normal file
34
apilibs/kexbases/Advapi32/TraceMessage.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT TraceMessage_new=TraceMessage */
|
||||
ULONG CDECL TraceMessage_new(
|
||||
ULONG64 LoggerHandle,
|
||||
ULONG MessageFlags,
|
||||
LPGUID MessageGuid,
|
||||
USHORT MessageNumber,
|
||||
...
|
||||
)
|
||||
{
|
||||
return ERROR_SUCCESS;
|
||||
}
|
120
apilibs/kexbases/Advapi32/_advapi32_apilist.c
Normal file
120
apilibs/kexbases/Advapi32/_advapi32_apilist.c
Normal file
@ -0,0 +1,120 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_advapi32_apilist.h"
|
||||
|
||||
BOOL init_advapi32()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const apilib_named_api advapi32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("AccessCheck", AccessCheck_new),
|
||||
DECL_API("AddAccessAllowedAce", AddAccessAllowedAce_new),
|
||||
DECL_API("AdjustTokenPrivileges", AdjustTokenPrivileges_new),
|
||||
DECL_API("AllocateAndInitializeSid", AllocateAndInitializeSid_new),
|
||||
DECL_API("CheckTokenMembership", CheckTokenMembership_new),
|
||||
DECL_API("ConvertSecurityDescriptorToStringSecurityDescriptorA", ConvertSecurityDescriptorToStringSecurityDescriptorA_stub),
|
||||
DECL_API("ConvertSecurityDescriptorToStringSecurityDescriptorW", ConvertSecurityDescriptorToStringSecurityDescriptorW_stub),
|
||||
DECL_API("ConvertSidToStringSidA", ConvertSidToStringSidA_stub),
|
||||
DECL_API("ConvertSidToStringSidW", ConvertSidToStringSidW_stub),
|
||||
DECL_API("ConvertStringSecurityDescriptorToSecurityDescriptorA", ConvertStringSecurityDescriptorToSecurityDescriptorA_stub),
|
||||
DECL_API("ConvertStringSecurityDescriptorToSecurityDescriptorW", ConvertStringSecurityDescriptorToSecurityDescriptorW_stub),
|
||||
DECL_API("ConvertStringSidToSidA", ConvertStringSidToSidA_stub),
|
||||
DECL_API("ConvertStringSidToSidW", ConvertStringSidToSidW_stub),
|
||||
DECL_API("CopySid", CopySid_new),
|
||||
DECL_API("CreateRestrictedToken", CreateRestrictedToken_new),
|
||||
DECL_API("CreateWellKnownSid", CreateWellKnownSid_new),
|
||||
DECL_API("CryptAcquireContextW", CryptAcquireContextW_stub),
|
||||
DECL_API("CryptEnumProviderTypesW", CryptEnumProviderTypesW_stub),
|
||||
DECL_API("CryptEnumProvidersW", CryptEnumProvidersW_stub),
|
||||
DECL_API("CryptGetDefaultProviderW", CryptGetDefaultProviderW_stub),
|
||||
DECL_API("CryptSetProviderExW", CryptSetProviderExW_stub),
|
||||
DECL_API("CryptSetProviderW", CryptSetProviderW_stub),
|
||||
DECL_API("CryptSignHashW", CryptSignHashW_stub),
|
||||
DECL_API("CryptVerifySignatureW", CryptVerifySignatureW_stub),
|
||||
DECL_API("DuplicateToken", DuplicateToken_new),
|
||||
DECL_API("DuplicateTokenEx", DuplicateTokenEx_new),
|
||||
DECL_API("EqualPrefixSid", EqualPrefixSid_new),
|
||||
DECL_API("EqualSid", EqualSid_new),
|
||||
DECL_API("FreeSid", FreeSid_new),
|
||||
DECL_API("GetAce", GetAce_new),
|
||||
DECL_API("GetFileSecurityA", GetFileSecurityA_new),
|
||||
DECL_API("GetFileSecurityW", GetFileSecurityW_new),
|
||||
DECL_API("GetLengthSid", GetLengthSid_new),
|
||||
DECL_API("GetSecurityDescriptorControl", GetSecurityDescriptorControl_new),
|
||||
DECL_API("GetSecurityDescriptorDacl", GetSecurityDescriptorDacl_new),
|
||||
DECL_API("GetSecurityDescriptorGroup", GetSecurityDescriptorGroup_new),
|
||||
DECL_API("GetSecurityDescriptorLength", GetSecurityDescriptorLength_new),
|
||||
DECL_API("GetSecurityDescriptorOwner", GetSecurityDescriptorOwner_new),
|
||||
DECL_API("GetSecurityDescriptorSacl", GetSecurityDescriptorSacl_new),
|
||||
DECL_API("GetSidIdentifierAuthority", GetSidIdentifierAuthority_new),
|
||||
DECL_API("GetSidLengthRequired", GetSidLengthRequired_new),
|
||||
DECL_API("GetSidSubAuthority", GetSidSubAuthority_new),
|
||||
DECL_API("GetSidSubAuthorityCount", GetSidSubAuthorityCount_new),
|
||||
DECL_API("GetTokenInformation", GetTokenInformation_new),
|
||||
DECL_API("ImpersonateSelf", ImpersonateSelf_new),
|
||||
DECL_API("InitializeAcl", InitializeAcl_new),
|
||||
DECL_API("InitializeSecurityDescriptor", InitializeSecurityDescriptor_new),
|
||||
DECL_API("InitializeSid", InitializeSid_new),
|
||||
DECL_API("IsValidSecurityDescriptor", IsValidSecurityDescriptor_new),
|
||||
DECL_API("IsValidSid", IsValidSid_new),
|
||||
DECL_API("IsWellKnownSid", IsWellKnownSid_stub),
|
||||
DECL_API("LookupAccountSidA", LookupAccountSidA_new),
|
||||
DECL_API("LookupAccountSidW", LookupAccountSidW_new),
|
||||
DECL_API("LookupPrivilegeValueA", LookupPrivilegeValueA_new),
|
||||
DECL_API("LookupPrivilegeValueW", LookupPrivilegeValueW_new),
|
||||
DECL_API("MakeSelfRelativeSD", MakeSelfRelativeSD_new),
|
||||
DECL_API("NotifyBootConfigStatus", NotifyBootConfigStatus_new),
|
||||
DECL_API("OpenProcessToken", OpenProcessToken_new),
|
||||
DECL_API("OpenThreadToken", OpenThreadToken_new),
|
||||
DECL_API("PrivilegeCheck", PrivilegeCheck_new),
|
||||
DECL_API("QueryServiceStatusEx", QueryServiceStatusEx_stub),
|
||||
DECL_API("RegDisablePredefinedCache", RegDisablePredefinedCache_new),
|
||||
DECL_API("RegOpenCurrentUser", RegOpenCurrentUser_new),
|
||||
DECL_API("RegOverridePredefKey", RegOverridePredefKey_stub),
|
||||
DECL_API("RegQueryValueExW", RegQueryValueExW_new),
|
||||
DECL_API("RevertToSelf", RevertToSelf_new),
|
||||
DECL_API("SetFileSecurityA", SetFileSecurityA_new),
|
||||
DECL_API("SetFileSecurityW", SetFileSecurityW_new),
|
||||
DECL_API("SetKernelObjectSecurity", SetKernelObjectSecurity_new),
|
||||
DECL_API("SetSecurityDescriptorDacl", SetSecurityDescriptorDacl_new),
|
||||
DECL_API("SetSecurityDescriptorGroup", SetSecurityDescriptorGroup_new),
|
||||
DECL_API("SetSecurityDescriptorOwner", SetSecurityDescriptorOwner_new),
|
||||
DECL_API("SetSecurityDescriptorSacl", SetSecurityDescriptorSacl_new),
|
||||
DECL_API("SetThreadToken", SetThreadToken_new),
|
||||
DECL_API("TraceMessage", TraceMessage_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api advapi32_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_advapi32 = DECL_TAB("ADVAPI32.DLL", advapi32_named_apis, 0 /*advapi32_ordinal_apis*/);
|
109
apilibs/kexbases/Advapi32/_advapi32_apilist.h
Normal file
109
apilibs/kexbases/Advapi32/_advapi32_apilist.h
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ADVAPI32_APILIST_H
|
||||
#define _ADVAPI32_APILIST_H
|
||||
|
||||
#include "auxdecl.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_advapi32();
|
||||
extern const apilib_api_table apitable_advapi32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
BOOL WINAPI RegDisablePredefinedCache_new();
|
||||
LONG WINAPI RegOpenCurrentUser_new(REGSAM access, PHKEY retkey);
|
||||
ULONG CDECL TraceMessage_new(ULONG64 LoggerHandle, ULONG MessageFlags, LPGUID MessageGuid, USHORT MessageNumber, ...);
|
||||
STUB CryptAcquireContextW_stub;
|
||||
STUB CryptEnumProvidersW_stub;
|
||||
STUB CryptEnumProviderTypesW_stub;
|
||||
STUB CryptGetDefaultProviderW_stub;
|
||||
STUB CryptSetProviderExW_stub;
|
||||
STUB CryptSetProviderW_stub;
|
||||
STUB CryptSignHashW_stub;
|
||||
STUB CryptVerifySignatureW_stub;
|
||||
STUB ConvertSidToStringSidA_stub;
|
||||
STUB ConvertStringSidToSidA_stub;
|
||||
STUB ConvertSidToStringSidW_stub;
|
||||
STUB ConvertStringSidToSidW_stub;
|
||||
STUB RegOverridePredefKey_stub;
|
||||
STUB IsWellKnownSid_stub;
|
||||
STUB ConvertStringSecurityDescriptorToSecurityDescriptorA_stub;
|
||||
STUB ConvertStringSecurityDescriptorToSecurityDescriptorW_stub;
|
||||
STUB ConvertSecurityDescriptorToStringSecurityDescriptorA_stub;
|
||||
STUB ConvertSecurityDescriptorToStringSecurityDescriptorW_stub;
|
||||
STUB QueryServiceStatusEx_stub;
|
||||
BOOL WINAPI OpenProcessToken_new(HANDLE ProcessHandle, DWORD DesiredAccess, HANDLE *TokenHandle);
|
||||
BOOL WINAPI OpenThreadToken_new(HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle);
|
||||
BOOL WINAPI DuplicateTokenEx_new(HANDLE ExistingTokenHandle, DWORD dwDesiredAccess, LPSECURITY_ATTRIBUTES lpTokenAttributes, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, TOKEN_TYPE TokenType, PHANDLE DuplicateTokenHandle);
|
||||
BOOL WINAPI DuplicateToken_new(HANDLE ExistingTokenHandle, SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, PHANDLE DuplicateTokenHandle);
|
||||
BOOL WINAPI AdjustTokenPrivileges_new(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, LPDWORD ReturnLength);
|
||||
BOOL WINAPI CheckTokenMembership_new(HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember);
|
||||
BOOL WINAPI GetTokenInformation_new(HANDLE token, TOKEN_INFORMATION_CLASS tokeninfoclass, LPVOID tokeninfo, DWORD tokeninfolength, LPDWORD retlen);
|
||||
BOOL WINAPI SetThreadToken_new(PHANDLE thread, HANDLE token);
|
||||
BOOL WINAPI AllocateAndInitializeSid_new(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid);
|
||||
PVOID WINAPI FreeSid_new(PSID pSid);
|
||||
BOOL WINAPI CopySid_new(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid);
|
||||
BOOL WINAPI IsValidSid_new(PSID pSid);
|
||||
BOOL WINAPI EqualSid_new(PSID pSid1, PSID pSid2);
|
||||
BOOL WINAPI EqualPrefixSid_new (PSID pSid1, PSID pSid2);
|
||||
DWORD WINAPI GetSidLengthRequired_new(BYTE nSubAuthorityCount);
|
||||
BOOL WINAPI InitializeSid_new (PSID pSid, PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount);
|
||||
PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority_new(PSID pSid);
|
||||
PDWORD WINAPI GetSidSubAuthority_new(PSID pSid, DWORD nSubAuthority);
|
||||
PUCHAR WINAPI GetSidSubAuthorityCount_new (PSID pSid);
|
||||
DWORD WINAPI GetLengthSid_new (PSID pSid);
|
||||
BOOL WINAPI InitializeSecurityDescriptor_new(SECURITY_DESCRIPTOR *pDescr, DWORD revision);
|
||||
DWORD WINAPI GetSecurityDescriptorLength_new(SECURITY_DESCRIPTOR *pDescr);
|
||||
BOOL WINAPI GetSecurityDescriptorOwner_new(SECURITY_DESCRIPTOR *pDescr, PSID *Owner, LPBOOL OwnerDefaulted);
|
||||
BOOL WINAPI SetSecurityDescriptorOwner_new(PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID owner, BOOL ownerdefaulted);
|
||||
BOOL WINAPI GetSecurityDescriptorGroup_new(PSECURITY_DESCRIPTOR SecurityDescriptor, PSID *Group, LPBOOL GroupDefaulted);
|
||||
BOOL WINAPI SetSecurityDescriptorGroup_new (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID group, BOOL groupdefaulted);
|
||||
BOOL WINAPI IsValidSecurityDescriptor_new(PSECURITY_DESCRIPTOR pSecurityDescriptor);
|
||||
BOOL WINAPI GetSecurityDescriptorDacl_new(IN PSECURITY_DESCRIPTOR pSecurityDescriptor, OUT LPBOOL lpbDaclPresent, OUT PACL *pDacl, OUT LPBOOL lpbDaclDefaulted);
|
||||
BOOL WINAPI SetSecurityDescriptorDacl_new (PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL daclpresent, PACL dacl, BOOL dacldefaulted);
|
||||
BOOL WINAPI GetSecurityDescriptorSacl_new(IN PSECURITY_DESCRIPTOR pSecurityDescriptor, OUT LPBOOL lpbSaclPresent, OUT PACL *pSacl, OUT LPBOOL lpbSaclDefaulted);
|
||||
BOOL WINAPI SetSecurityDescriptorSacl_new (PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL saclpresent, PACL sacl, BOOL sacldefaulted);
|
||||
BOOL WINAPI MakeSelfRelativeSD_new(IN PSECURITY_DESCRIPTOR pAbsoluteSecurityDescriptor, IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, IN OUT LPDWORD lpdwBufferLength);
|
||||
BOOL WINAPI GetSecurityDescriptorControl_new (PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision);
|
||||
BOOL WINAPI InitializeAcl_new(PACL acl, DWORD size, DWORD rev);
|
||||
BOOL WINAPI LookupPrivilegeValueW_new(LPCWSTR lpSystemName, LPCWSTR lpName, PLUID lpLuid);
|
||||
BOOL WINAPI LookupPrivilegeValueA_new(LPCSTR lpSystemName, LPCSTR lpName, PLUID lpLuid);
|
||||
BOOL WINAPI GetFileSecurityW_new(LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, SECURITY_DESCRIPTOR* pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded);
|
||||
BOOL WINAPI GetFileSecurityA_new(LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, SECURITY_DESCRIPTOR* pSecurityDescriptor, DWORD nLength, LPDWORD lpnLengthNeeded);
|
||||
BOOL WINAPI LookupAccountSidA_new(IN LPCSTR system, IN PSID sid, OUT LPSTR account, IN OUT LPDWORD accountSize, OUT LPSTR domain, IN OUT LPDWORD domainSize, OUT PSID_NAME_USE name_use);
|
||||
BOOL WINAPI LookupAccountSidW_new(IN LPCWSTR system, IN PSID sid, OUT LPWSTR account, IN OUT LPDWORD accountSize, OUT LPWSTR domain, IN OUT LPDWORD domainSize, OUT PSID_NAME_USE name_use);
|
||||
BOOL WINAPI SetFileSecurityA_new(LPCSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor);
|
||||
BOOL WINAPI SetFileSecurityW_new(LPCWSTR lpFileName, SECURITY_INFORMATION RequestedInformation, PSECURITY_DESCRIPTOR pSecurityDescriptor);
|
||||
BOOL WINAPI NotifyBootConfigStatus_new(BOOL x1);
|
||||
BOOL WINAPI RevertToSelf_new(void);
|
||||
BOOL WINAPI ImpersonateSelf_new(SECURITY_IMPERSONATION_LEVEL ImpersonationLevel);
|
||||
BOOL WINAPI AccessCheck_new(PSECURITY_DESCRIPTOR SecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, PGENERIC_MAPPING GenericMapping, PPRIVILEGE_SET PrivilegeSet, LPDWORD PrivilegeSetLength, LPDWORD GrantedAccess, LPBOOL AccessStatus);
|
||||
BOOL WINAPI SetKernelObjectSecurity_new (IN HANDLE Handle, IN SECURITY_INFORMATION SecurityInformation, IN PSECURITY_DESCRIPTOR SecurityDescriptor);
|
||||
BOOL WINAPI PrivilegeCheck_new(HANDLE ClientToken, PPRIVILEGE_SET RequiredPrivileges, LPBOOL pfResult);
|
||||
BOOL WINAPI AddAccessAllowedAce_new(IN OUT PACL pAcl, IN DWORD dwAceRevision, IN DWORD AccessMask, IN PSID pSid);
|
||||
BOOL WINAPI GetAce_new(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce);
|
||||
BOOL WINAPI CreateRestrictedToken_new(HANDLE baseToken, DWORD flags, DWORD nDisableSids, PSID_AND_ATTRIBUTES disableSids, DWORD nDeletePrivs, PLUID_AND_ATTRIBUTES deletePrivs, DWORD nRestrictSids, PSID_AND_ATTRIBUTES restrictSids, PHANDLE newToken);
|
||||
BOOL WINAPI CreateWellKnownSid_new(DWORD WellKnownSidType, PSID DomainSid, PSID pSid, DWORD* cbSid);
|
||||
LONG WINAPI RegQueryValueExW_new(HKEY hKey, LPCWSTR lpValueNameW, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
46
apilibs/kexbases/Advapi32/_advapi32_stubs.c
Normal file
46
apilibs/kexbases/Advapi32/_advapi32_stubs.c
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
UNIMPL_FUNC(CryptAcquireContextW, 5); //all MSLU does is to load this function from advapi32 so it loops...
|
||||
UNIMPL_FUNC(CryptEnumProvidersW, 6); //so it loops...
|
||||
UNIMPL_FUNC(CryptEnumProviderTypesW, 6); //so it loops...
|
||||
UNIMPL_FUNC(CryptGetDefaultProviderW, 5); //so it loops...
|
||||
UNIMPL_FUNC(CryptSetProviderExW, 4); //...
|
||||
UNIMPL_FUNC(CryptSetProviderW, 2); //...
|
||||
UNIMPL_FUNC(CryptSignHashW, 6); //...
|
||||
UNIMPL_FUNC(CryptVerifySignatureW, 6); //...
|
||||
|
||||
UNIMPL_FUNC(ConvertSidToStringSidA, 2);
|
||||
UNIMPL_FUNC(ConvertStringSidToSidA, 2);
|
||||
UNIMPL_FUNC(ConvertSidToStringSidW, 2);
|
||||
UNIMPL_FUNC(ConvertStringSidToSidW, 2);
|
||||
UNIMPL_FUNC(RegOverridePredefKey, 2);
|
||||
UNIMPL_FUNC(IsWellKnownSid, 2);
|
||||
|
||||
UNIMPL_FUNC(ConvertStringSecurityDescriptorToSecurityDescriptorA, 4);
|
||||
UNIMPL_FUNC(ConvertStringSecurityDescriptorToSecurityDescriptorW, 4);
|
||||
|
||||
UNIMPL_FUNC(ConvertSecurityDescriptorToStringSecurityDescriptorA, 5);
|
||||
UNIMPL_FUNC(ConvertSecurityDescriptorToStringSecurityDescriptorW, 5);
|
||||
|
||||
UNIMPL_FUNC(QueryServiceStatusEx, 5);
|
1613
apilibs/kexbases/Advapi32/security.c
Normal file
1613
apilibs/kexbases/Advapi32/security.c
Normal file
File diff suppressed because it is too large
Load Diff
113
apilibs/kexbases/Advapi32/uniadvapi32.c
Normal file
113
apilibs/kexbases/Advapi32/uniadvapi32.c
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
//MAKE_EXPORT RegQueryValueExW_new=RegQueryValueExW
|
||||
LONG WINAPI RegQueryValueExW_new(HKEY hKey, LPCWSTR lpValueNameW, LPDWORD lpReserved,
|
||||
LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
|
||||
{
|
||||
LONG ret;
|
||||
DWORD type;
|
||||
BYTE stackbuf[256];
|
||||
BYTE* ptr = stackbuf;
|
||||
BYTE* heapbuf = NULL;
|
||||
DWORD bufsize = sizeof(stackbuf);
|
||||
|
||||
if ((lpData && !lpcbData) || lpReserved) return ERROR_INVALID_PARAMETER;
|
||||
if (!lpData && lpcbData) *lpcbData = 0;
|
||||
|
||||
//try with stack buffer first
|
||||
if (lpValueNameW)
|
||||
{
|
||||
ALLOC_WtoA(lpValueName);
|
||||
ret = RegQueryValueExA(hKey, lpValueNameA, lpReserved, &type, ptr, &bufsize);
|
||||
if (lpType) *lpType = type;
|
||||
if (lpcbData && type != REG_SZ && bufsize > *lpcbData)
|
||||
{
|
||||
*lpcbData = bufsize;
|
||||
return ERROR_MORE_DATA;
|
||||
}
|
||||
//retry with dynamic buffer
|
||||
if (ret == ERROR_MORE_DATA)
|
||||
{
|
||||
ptr = heapbuf = (BYTE*) HeapAlloc(GetProcessHeap(), 0, bufsize);
|
||||
if (!heapbuf)
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
ret = RegQueryValueExA(hKey, lpValueNameA, lpReserved, &type, ptr, &bufsize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = RegQueryValueExA(hKey, 0, lpReserved, &type, ptr, &bufsize);
|
||||
if (lpType) *lpType = type;
|
||||
if (lpcbData && type != REG_SZ && bufsize > *lpcbData)
|
||||
{
|
||||
*lpcbData = bufsize;
|
||||
return ERROR_MORE_DATA;
|
||||
}
|
||||
//retry with dynamic buffer
|
||||
if (ret == ERROR_MORE_DATA)
|
||||
{
|
||||
ptr = heapbuf = (BYTE*) HeapAlloc(GetProcessHeap(), 0, bufsize);
|
||||
if (!heapbuf)
|
||||
{
|
||||
return ERROR_NOT_ENOUGH_MEMORY;
|
||||
}
|
||||
ret = RegQueryValueExA(hKey, 0, lpReserved, &type, ptr, &bufsize);
|
||||
}
|
||||
}
|
||||
if (ret != ERROR_SUCCESS) goto _end;
|
||||
|
||||
if (type == REG_SZ)
|
||||
{
|
||||
if (lpcbData)
|
||||
{
|
||||
DWORD gle = GetLastError();
|
||||
int written = MultiByteToWideChar(CP_ACP, 0, (LPSTR) ptr, -1,
|
||||
(LPWSTR)lpData, lpData ? (*lpcbData >> 1) : 0);
|
||||
if (!written)
|
||||
{
|
||||
ret = GetLastError();
|
||||
if (ret == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
*lpcbData = MultiByteToWideChar(CP_ACP, 0, (LPSTR) ptr,
|
||||
-1, NULL, 0) << 1;
|
||||
ret = ERROR_MORE_DATA;
|
||||
}
|
||||
SetLastError(gle);
|
||||
goto _end;
|
||||
}
|
||||
*lpcbData = written << 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lpData) memcpy(lpData, ptr, bufsize);
|
||||
if (lpcbData) *lpcbData = bufsize;
|
||||
}
|
||||
|
||||
_end:
|
||||
if (heapbuf) HeapFree(GetProcessHeap(), 0, heapbuf);
|
||||
return ret;
|
||||
}
|
34
apilibs/kexbases/Gdi32/FontResourceExA.c
Normal file
34
apilibs/kexbases/Gdi32/FontResourceExA.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2009, Xeno86
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT AddFontResourceExA_new=AddFontResourceExA */
|
||||
INT WINAPI AddFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv)
|
||||
{
|
||||
return AddFontResourceA(str);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT RemoveFontResourceExA_new=RemoveFontResourceExA */
|
||||
BOOL WINAPI RemoveFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv)
|
||||
{
|
||||
return RemoveFontResourceA(str);
|
||||
}
|
39
apilibs/kexbases/Gdi32/GetGlyphOutlineA_fix.c
Normal file
39
apilibs/kexbases/Gdi32/GetGlyphOutlineA_fix.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT GetGlyphOutlineA_fix=GetGlyphOutlineA */
|
||||
DWORD WINAPI GetGlyphOutlineA_fix(
|
||||
HDC hdc, // handle to DC
|
||||
UINT uChar, // character to query
|
||||
UINT uFormat, // data format
|
||||
LPGLYPHMETRICS lpgm, // glyph metrics
|
||||
DWORD cbBuffer, // size of data buffer
|
||||
LPVOID lpvBuffer, // data buffer
|
||||
CONST MAT2 *lpmat2 // transformation matrix
|
||||
)
|
||||
{
|
||||
//last parameter must point to writeable memory
|
||||
MAT2 matr;
|
||||
memcpy( &matr, lpmat2, sizeof(MAT2) );
|
||||
return GetGlyphOutlineA( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, &matr );
|
||||
}
|
230
apilibs/kexbases/Gdi32/TextOut.c
Normal file
230
apilibs/kexbases/Gdi32/TextOut.c
Normal file
@ -0,0 +1,230 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
* 1997 Alex Korobka
|
||||
* Copyright 2002,2003 Shachar Shemesh
|
||||
* Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
|
||||
*
|
||||
* Copyright (C) 2008, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "auxdecl.h"
|
||||
|
||||
#ifndef ETO_PDY
|
||||
#define ETO_PDY 0x2000
|
||||
#endif
|
||||
|
||||
static void WINAPI MakeDxFromDxDy(const int* lpDx, int* newlpDx, UINT cbCount)
|
||||
{
|
||||
UINT oneDx;
|
||||
for (oneDx = 0; oneDx < cbCount; oneDx++)
|
||||
{
|
||||
*newlpDx = *lpDx;
|
||||
newlpDx++;
|
||||
lpDx++;
|
||||
lpDx++;
|
||||
}
|
||||
newlpDx--;
|
||||
if (*newlpDx == 0) *newlpDx = 16; //TERRIBLE HACK but needed on some fonts/glyphs/etc!
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT ExtTextOutA_new=ExtTextOutA */
|
||||
BOOL WINAPI ExtTextOutA_new(
|
||||
HDC hdc, // handle to DC
|
||||
int X, // x-coordinate of reference point
|
||||
int Y, // y-coordinate of reference point
|
||||
UINT fuOptions, // text-output options
|
||||
CONST RECT* lprc, // optional dimensions
|
||||
LPCSTR lpString, // string
|
||||
UINT cbCount, // number of characters in string
|
||||
CONST INT* lpDx // array of spacing values
|
||||
)
|
||||
{
|
||||
BOOL result;
|
||||
int* buffer = 0;
|
||||
|
||||
if ((UINT)lpString>0xFFFFu)
|
||||
{
|
||||
if (cbCount>8192) cbCount = 8192;
|
||||
if (fuOptions & ETO_PDY) //win9x can't understand it and messes up other flags
|
||||
{
|
||||
fuOptions = fuOptions & ~ETO_PDY;
|
||||
if (lpDx) //we have to make array which contains dx values only
|
||||
{
|
||||
buffer = (int*)HeapAlloc(GetProcessHeap(),0,cbCount*sizeof(int));
|
||||
if (!buffer) //you've managed to ruin everything
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
MakeDxFromDxDy(lpDx,buffer, cbCount);
|
||||
lpDx = buffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
result = ExtTextOutA(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
|
||||
if (buffer) HeapFree (GetProcessHeap(),0,buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* MAKE_EXPORT ExtTextOutW_new=ExtTextOutW */
|
||||
BOOL WINAPI ExtTextOutW_new(
|
||||
HDC hdc, // handle to DC
|
||||
int X, // x-coordinate of reference point
|
||||
int Y, // y-coordinate of reference point
|
||||
UINT fuOptions, // text-output options
|
||||
CONST RECT* lprc, // optional dimensions
|
||||
LPCWSTR lpString, // string
|
||||
UINT cbCount, // number of characters in string
|
||||
CONST INT* lpDx // array of spacing values
|
||||
)
|
||||
{
|
||||
BOOL result;
|
||||
BOOL optimized = FALSE;
|
||||
int* buffer = 0;
|
||||
char english[128];
|
||||
|
||||
if ((UINT)lpString>0xFFFFu)
|
||||
{
|
||||
if (cbCount>8192) cbCount = 8192;
|
||||
if (fuOptions & ETO_PDY)
|
||||
{
|
||||
fuOptions = fuOptions & ~ETO_PDY;
|
||||
if (lpDx)
|
||||
{
|
||||
buffer = (int*)HeapAlloc(GetProcessHeap(),0,cbCount*sizeof(int));
|
||||
if (!buffer)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
MakeDxFromDxDy(lpDx,buffer,cbCount);
|
||||
lpDx = buffer;
|
||||
}
|
||||
}
|
||||
//now, common case optimization (English short string)
|
||||
if (!(fuOptions & ETO_GLYPH_INDEX || cbCount>128 || *lpString>0x7Fu))
|
||||
{
|
||||
UINT i;
|
||||
LPCWSTR uString = lpString;
|
||||
for (i = 0; i< cbCount; i++)
|
||||
{
|
||||
if (*uString>0x7Fu) break; else english[i]=(char)*uString;
|
||||
uString++;
|
||||
}
|
||||
optimized = (i == cbCount);
|
||||
}
|
||||
else
|
||||
optimized = FALSE;
|
||||
}
|
||||
|
||||
if (optimized)
|
||||
result = ExtTextOutA(hdc,X,Y,fuOptions,lprc,english,cbCount,lpDx);
|
||||
else
|
||||
result = ExtTextOutW(hdc,X,Y,fuOptions,lprc,lpString,cbCount,lpDx);
|
||||
|
||||
if (buffer) HeapFree (GetProcessHeap(),0,buffer);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT PolyTextOutA_new=PolyTextOutA */
|
||||
BOOL WINAPI PolyTextOutA_new( HDC hdc, const POLYTEXTA *pptxt, INT cStrings )
|
||||
{
|
||||
if (!hdc || !cStrings || !pptxt)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
for (; cStrings>0; cStrings--, pptxt++)
|
||||
if (!ExtTextOutA_new (hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT PolyTextOutW_new=PolyTextOutW */
|
||||
BOOL WINAPI PolyTextOutW_new( HDC hdc, const POLYTEXTW *pptxt, INT cStrings )
|
||||
{
|
||||
if (!hdc || !cStrings || !pptxt)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
for (; cStrings>0; cStrings--, pptxt++)
|
||||
if (!ExtTextOutW_new (hdc, pptxt->x, pptxt->y, pptxt->uiFlags, &pptxt->rcl, pptxt->lpstr, pptxt->n, pptxt->pdx ))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetFontUnicodeRanges_new=GetFontUnicodeRanges */
|
||||
DWORD WINAPI GetFontUnicodeRanges_new(
|
||||
HDC hdc,
|
||||
LPGLYPHSET lpgs
|
||||
)
|
||||
{
|
||||
SetLastError(ERROR_NOT_SUPPORTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* On 9x fallback to system function */
|
||||
/* MAKE_EXPORT SetGraphicsMode_NT=SetGraphicsMode */
|
||||
int WINAPI SetGraphicsMode_NT(
|
||||
HDC hdc, // handle to device context
|
||||
int iMode // graphics mode
|
||||
)
|
||||
{
|
||||
return GM_COMPATIBLE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SetWorldTransform_9x=SetWorldTransform */
|
||||
BOOL WINAPI SetWorldTransform_9x(
|
||||
HDC hdc, // handle to device context
|
||||
CONST XFORM *lpXform // transformation data
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SetWorldTransform_NT=SetWorldTransform */
|
||||
BOOL WINAPI SetWorldTransform_NT(
|
||||
HDC hdc, // handle to device context
|
||||
CONST XFORM *lpXform // transformation data
|
||||
)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetRandomRgn_NT=GetRandomRgn */
|
||||
int WINAPI GetRandomRgn_NT(
|
||||
HDC hdc, // handle to DC
|
||||
HRGN hrgn, // handle to region
|
||||
INT iNum // must be SYSRGN
|
||||
)
|
||||
{
|
||||
int result = GetRandomRgn(hdc,hrgn,iNum);
|
||||
if (result)
|
||||
{
|
||||
POINT pt;
|
||||
GetDCOrgEx(hdc,&pt);
|
||||
OffsetRgn(hrgn,pt.x,pt.y);
|
||||
}
|
||||
return result;
|
||||
}
|
72
apilibs/kexbases/Gdi32/_gdi32_apilist.c
Normal file
72
apilibs/kexbases/Gdi32/_gdi32_apilist.c
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_gdi32_apilist.h"
|
||||
|
||||
BOOL init_gdi32()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* MAKE_EXPORT GetCharWidthA=GetCharWidth32A
|
||||
* MAKE_EXPORT GetCharWidthW=GetCharWidth32W
|
||||
*/
|
||||
|
||||
static const apilib_named_api gdi32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("AddFontMemResourceEx", AddFontMemResourceEx_stub),
|
||||
DECL_API("AddFontResourceExA", AddFontResourceExA_new),
|
||||
DECL_API("AddFontResourceExW", AddFontResourceExW_new),
|
||||
DECL_API("AddFontResourceW", AddFontResourceW_new),
|
||||
DECL_API("ExtTextOutA", ExtTextOutA_new),
|
||||
DECL_API("ExtTextOutW", ExtTextOutW_new),
|
||||
DECL_API("GetCharWidth32A", GetCharWidthA),
|
||||
DECL_API("GetCharWidth32W", GetCharWidthW),
|
||||
DECL_API("GetFontUnicodeRanges", GetFontUnicodeRanges_new),
|
||||
DECL_API("GetGlyphOutlineA", GetGlyphOutlineA_fix),
|
||||
DECL_API("GetRandomRgn", GetRandomRgn_NT),
|
||||
DECL_API("PolyTextOutA", PolyTextOutA_new),
|
||||
DECL_API("PolyTextOutW", PolyTextOutW_new),
|
||||
DECL_API("RemoveFontMemResourceEx", RemoveFontMemResourceEx_stub),
|
||||
DECL_API("RemoveFontResourceExA", RemoveFontResourceExA_new),
|
||||
DECL_API("RemoveFontResourceExW", RemoveFontResourceExW_new),
|
||||
DECL_API("RemoveFontResourceW", RemoveFontResourceW_new),
|
||||
DECL_API("SetDCBrushColor", SetDCBrushColor_stub),
|
||||
DECL_API("SetDCPenColor", SetDCPenColor_stub),
|
||||
DECL_API("SetGraphicsMode", SetGraphicsMode_NT),
|
||||
DECL_API("SetWorldTransform", SetWorldTransform_9x),
|
||||
DECL_API("SetWorldTransform", SetWorldTransform_NT),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api gdi32_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_gdi32 = DECL_TAB("GDI32.DLL", gdi32_named_apis, 0 /*gdi32_ordinal_apis*/);
|
54
apilibs/kexbases/Gdi32/_gdi32_apilist.h
Normal file
54
apilibs/kexbases/Gdi32/_gdi32_apilist.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GDI32_APILIST_H
|
||||
#define _GDI32_APILIST_H
|
||||
|
||||
#include "auxdecl.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_gdi32();
|
||||
extern const apilib_api_table apitable_gdi32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
INT WINAPI AddFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
|
||||
BOOL WINAPI RemoveFontResourceExA_new(LPCSTR str, DWORD fl, PVOID pdv);
|
||||
DWORD WINAPI GetGlyphOutlineA_fix(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2);
|
||||
BOOL WINAPI ExtTextOutA_new(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT* lprc, LPCSTR lpString, UINT cbCount, CONST INT* lpDx);
|
||||
BOOL WINAPI ExtTextOutW_new(HDC hdc, int X, int Y, UINT fuOptions, CONST RECT* lprc, LPCWSTR lpString, UINT cbCount, CONST INT* lpDx);
|
||||
BOOL WINAPI PolyTextOutA_new(HDC hdc, const POLYTEXTA *pptxt, INT cStrings);
|
||||
BOOL WINAPI PolyTextOutW_new(HDC hdc, const POLYTEXTW *pptxt, INT cStrings);
|
||||
DWORD WINAPI GetFontUnicodeRanges_new(HDC hdc, LPGLYPHSET lpgs);
|
||||
int WINAPI SetGraphicsMode_NT(HDC hdc, int iMode);
|
||||
BOOL WINAPI SetWorldTransform_9x(HDC hdc, CONST XFORM *lpXform);
|
||||
BOOL WINAPI SetWorldTransform_NT(HDC hdc, CONST XFORM *lpXform);
|
||||
int WINAPI GetRandomRgn_NT(HDC hdc, HRGN hrgn, INT iNum);
|
||||
STUB SetDCBrushColor_stub;
|
||||
STUB SetDCPenColor_stub;
|
||||
STUB AddFontMemResourceEx_stub;
|
||||
STUB RemoveFontMemResourceEx_stub;
|
||||
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
|
||||
INT WINAPI AddFontResourceW_new(LPCWSTR strW);
|
||||
BOOL WINAPI RemoveFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv);
|
||||
BOOL WINAPI RemoveFontResourceW_new(LPCWSTR strW);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
27
apilibs/kexbases/Gdi32/_gdi32_stubs.c
Normal file
27
apilibs/kexbases/Gdi32/_gdi32_stubs.c
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2009, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
UNIMPL_FUNC(SetDCBrushColor, 2);
|
||||
UNIMPL_FUNC(SetDCPenColor, 2);
|
||||
UNIMPL_FUNC(AddFontMemResourceEx, 4);
|
||||
UNIMPL_FUNC(RemoveFontMemResourceEx, 1);
|
55
apilibs/kexbases/Gdi32/unigdi32.c
Normal file
55
apilibs/kexbases/Gdi32/unigdi32.c
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2009, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "_gdi32_apilist.h"
|
||||
|
||||
//MAKE_EXPORT AddFontResourceExW_new=AddFontResourceExW
|
||||
INT WINAPI AddFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
return AddFontResourceExA_new(strA, fl, pdv);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT AddFontResourceW_new=AddFontResourceW
|
||||
INT WINAPI AddFontResourceW_new(LPCWSTR strW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
return AddFontResourceA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT RemoveFontResourceExW_new=RemoveFontResourceExW
|
||||
BOOL WINAPI RemoveFontResourceExW_new(LPCWSTR strW, DWORD fl, PVOID pdv)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
return RemoveFontResourceExA_new(strA, fl, pdv);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT RemoveFontResourceW_new=RemoveFontResourceW
|
||||
BOOL WINAPI RemoveFontResourceW_new(LPCWSTR strW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
return RemoveFontResourceA(strA);
|
||||
}
|
29
apilibs/kexbases/Kernel32/CopyFileEx.c
Normal file
29
apilibs/kexbases/Kernel32/CopyFileEx.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT CopyFileExA_new=CopyFileExA */
|
||||
BOOL WINAPI CopyFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags)
|
||||
{
|
||||
return CopyFileA(lpExistingFileNameA, lpNewFileNameA,
|
||||
(dwCopyFlags & COPY_FILE_FAIL_IF_EXISTS) != 0);
|
||||
}
|
44
apilibs/kexbases/Kernel32/CreateFileA_fix.c
Normal file
44
apilibs/kexbases/Kernel32/CreateFileA_fix.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008-2009, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT CreateFileA_fix=CreateFileA */
|
||||
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess,
|
||||
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
|
||||
{
|
||||
/* translate NT-specific access rights to generic ones */
|
||||
if (dwDesiredAccess & ~0xf0010100)
|
||||
{
|
||||
DWORD oldaccess = dwDesiredAccess;
|
||||
dwDesiredAccess &= 0xf0010100;
|
||||
if (oldaccess & FILE_READ_DATA)
|
||||
dwDesiredAccess |= GENERIC_READ;
|
||||
if (oldaccess & FILE_WRITE_DATA)
|
||||
dwDesiredAccess |= GENERIC_WRITE;
|
||||
if (oldaccess & FILE_EXECUTE)
|
||||
dwDesiredAccess |= GENERIC_EXECUTE;
|
||||
}
|
||||
// hTemplate has to be NULL on 9x
|
||||
return CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes,
|
||||
dwCreationDistribution, dwFlagsAndAttributes, NULL);
|
||||
}
|
37
apilibs/kexbases/Kernel32/CreateThread_fix.c
Normal file
37
apilibs/kexbases/Kernel32/CreateThread_fix.c
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT CreateThread_fix=CreateThread */
|
||||
HANDLE WINAPI CreateThread_fix(
|
||||
LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
|
||||
SIZE_T dwStackSize, // initial stack size
|
||||
LPTHREAD_START_ROUTINE lpStartAddress, // thread function
|
||||
LPVOID lpParameter, // thread argument
|
||||
DWORD dwCreationFlags, // creation option
|
||||
LPDWORD lpThreadId // thread identifier
|
||||
)
|
||||
{
|
||||
DWORD dummy;
|
||||
if ( !lpThreadId ) lpThreadId = &dummy;
|
||||
return CreateThread( lpThreadAttributes, dwStackSize, lpStartAddress, lpParameter, dwCreationFlags, lpThreadId );
|
||||
}
|
30
apilibs/kexbases/Kernel32/DeleteCriticalSection.c
Normal file
30
apilibs/kexbases/Kernel32/DeleteCriticalSection.c
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT DeleteCriticalSection_new=DeleteCriticalSection */
|
||||
void WINAPI DeleteCriticalSection_new(PCRITICAL_SECTION lpCriticalSection)
|
||||
{
|
||||
//make DeleteCriticalSection not fail on deleted section
|
||||
byte* deleted = (byte*) lpCriticalSection;
|
||||
if (*deleted != 0) DeleteCriticalSection(lpCriticalSection);
|
||||
}
|
38
apilibs/kexbases/Kernel32/GetFileSizeEx.c
Normal file
38
apilibs/kexbases/Kernel32/GetFileSizeEx.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2006, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT GetFileSizeEx_new=GetFileSizeEx */
|
||||
BOOL WINAPI GetFileSizeEx_new(HANDLE hFile, PLARGE_INTEGER lpFileSize)
|
||||
{
|
||||
DWORD h, l, lasterr;
|
||||
lasterr = GetLastError();
|
||||
l = GetFileSize(hFile, &h);
|
||||
if (l == INVALID_FILE_SIZE && GetLastError() != NO_ERROR) return FALSE;
|
||||
else
|
||||
{
|
||||
lpFileSize->HighPart = h;
|
||||
lpFileSize->LowPart = l;
|
||||
}
|
||||
SetLastError(lasterr);
|
||||
return TRUE;
|
||||
}
|
48
apilibs/kexbases/Kernel32/GlobalMemoryStatusEx.c
Normal file
48
apilibs/kexbases/Kernel32/GlobalMemoryStatusEx.c
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "auxdecl.h"
|
||||
|
||||
/* MAKE_EXPORT GlobalMemoryStatusEx_new=GlobalMemoryStatusEx */
|
||||
BOOL WINAPI GlobalMemoryStatusEx_new(LPMEMORYSTATUSEX lpmemex)
|
||||
{
|
||||
MEMORYSTATUS mem;
|
||||
|
||||
if (lpmemex->dwLength != sizeof(*lpmemex))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
mem.dwLength = sizeof(mem);
|
||||
GlobalMemoryStatus(&mem);
|
||||
lpmemex->dwMemoryLoad = mem.dwMemoryLoad;
|
||||
lpmemex->ullTotalPhys = mem.dwTotalPhys;
|
||||
lpmemex->ullAvailPhys = mem.dwAvailPhys;
|
||||
lpmemex->ullTotalPageFile = mem.dwTotalPageFile;
|
||||
lpmemex->ullAvailPageFile = mem.dwAvailPageFile;
|
||||
lpmemex->ullTotalVirtual = mem.dwTotalVirtual;
|
||||
lpmemex->ullAvailVirtual = mem.dwAvailVirtual;
|
||||
lpmemex->ullAvailExtendedVirtual = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
51
apilibs/kexbases/Kernel32/HeapLocks.c
Normal file
51
apilibs/kexbases/Kernel32/HeapLocks.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
static BOOL IsValidHeap(HANDLE hHeap)
|
||||
{
|
||||
WORD *sig;
|
||||
if ( IsBadReadPtr(hHeap,0x74) ) return FALSE;
|
||||
sig = (WORD*)((DWORD)hHeap+0x72);
|
||||
if ( *sig != 0x4948 ) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT HeapLock_new=HeapLock */
|
||||
BOOL WINAPI HeapLock_new(
|
||||
HANDLE hHeap
|
||||
)
|
||||
{
|
||||
if ( !IsValidHeap(hHeap) ) return FALSE;
|
||||
EnterCriticalSection((CRITICAL_SECTION*)((DWORD)hHeap+0x50));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT HeapUnlock_new=HeapUnlock */
|
||||
BOOL WINAPI HeapUnlock_new(
|
||||
HANDLE hHeap
|
||||
)
|
||||
{
|
||||
if ( !IsValidHeap(hHeap) ) return FALSE;
|
||||
LeaveCriticalSection((CRITICAL_SECTION*)((DWORD)hHeap+0x50));
|
||||
return TRUE;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT InitializeCriticalSectionAndSpinCount_new=InitializeCriticalSectionAndSpinCount */
|
||||
BOOL WINAPI InitializeCriticalSectionAndSpinCount_new(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount)
|
||||
{
|
||||
InitializeCriticalSection(lpCriticalSection);
|
||||
return TRUE;
|
||||
}
|
81
apilibs/kexbases/Kernel32/Jobs.c
Normal file
81
apilibs/kexbases/Kernel32/Jobs.c
Normal file
@ -0,0 +1,81 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
* Copyright (C) 2008, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT CreateJobObjectA_new=CreateJobObjectA */
|
||||
HANDLE WINAPI CreateJobObjectA_new(LPSECURITY_ATTRIBUTES sa, LPCSTR name)
|
||||
{
|
||||
return (HANDLE) 0x1ee7;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT CreateJobObjectW_new=CreateJobObjectW */
|
||||
HANDLE WINAPI CreateJobObjectW_new(LPSECURITY_ATTRIBUTES sa, LPCWSTR name)
|
||||
{
|
||||
return (HANDLE) 0x1ee7;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT TerminateJobObject_new=TerminateJobObject */
|
||||
BOOL WINAPI TerminateJobObject_new(HANDLE job, UINT exit_code)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT OpenJobObjectA_new=OpenJobObjectA */
|
||||
HANDLE WINAPI OpenJobObjectA_new(DWORD access, BOOL inherit, LPCSTR name)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT OpenJobObjectW_new=OpenJobObjectW */
|
||||
HANDLE WINAPI OpenJobObjectW_new(DWORD access, BOOL inherit, LPCWSTR name)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT QueryInformationJobObject_new=QueryInformationJobObject */
|
||||
BOOL WINAPI QueryInformationJobObject_new(HANDLE job, PVOID classs, LPVOID info, DWORD len, DWORD *ret_len)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT SetInformationJobObject_new=SetInformationJobObject */
|
||||
BOOL WINAPI SetInformationJobObject_new(HANDLE job, PVOID classs, LPVOID info, DWORD len)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT AssignProcessToJobObject_new=AssignProcessToJobObject */
|
||||
BOOL WINAPI AssignProcessToJobObject_new(HANDLE job, HANDLE process)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT IsProcessInJob_new=IsProcessInJob */
|
||||
BOOL WINAPI IsProcessInJob_new(HANDLE process, HANDLE job, PBOOL result)
|
||||
{
|
||||
*result = FALSE;
|
||||
return TRUE;
|
||||
}
|
31
apilibs/kexbases/Kernel32/KEXVersion.c
Normal file
31
apilibs/kexbases/Kernel32/KEXVersion.c
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2009, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
/* MAKE_EXPORT KEXVersion=KEXVersion */
|
||||
void WINAPI KEXVersion(char* out)
|
||||
{
|
||||
unsigned long ver = kexGetKEXVersion();
|
||||
sprintf(out, "%d.%d.%d", (ver>>24) & 0xff, (ver>>16) & 0xff, ver & 0xffff);
|
||||
}
|
36
apilibs/kexbases/Kernel32/LockFileEx.c
Normal file
36
apilibs/kexbases/Kernel32/LockFileEx.c
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT LockFileEx_new=LockFileEx */
|
||||
BOOL WINAPI LockFileEx_new(HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped)
|
||||
{
|
||||
/* FIXME: flags LOCKFILE_FAIL_IMMEDIATELY and LOCKFILE_EXCLUSIVE_LOCK not supported (always set),
|
||||
Event signalling not supported
|
||||
*/
|
||||
if (dwReserved)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
return LockFile(hFile, lpOverlapped->Offset, lpOverlapped->OffsetHigh, nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh);
|
||||
}
|
44
apilibs/kexbases/Kernel32/MapViewOfFile.c
Normal file
44
apilibs/kexbases/Kernel32/MapViewOfFile.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT MapViewOfFileEx_new=MapViewOfFileEx */
|
||||
LPVOID WINAPI MapViewOfFileEx_new(
|
||||
HANDLE hFileMappingObject,
|
||||
DWORD dwDesiredAccess,
|
||||
DWORD dwFileOffsetHigh,
|
||||
DWORD dwFileOffsetLow,
|
||||
SIZE_T dwNumberOfBytesToMap,
|
||||
LPVOID lpBaseAddress
|
||||
)
|
||||
{
|
||||
/*
|
||||
* With this modification MapViewOfFileEx won't fail if lpBaseAddress
|
||||
* doesn't point to Shared Arena - it will ignore suggested starting address
|
||||
*/
|
||||
if ((DWORD)lpBaseAddress < 0x80000000 || (DWORD)lpBaseAddress >= 0xc0000000)
|
||||
{
|
||||
lpBaseAddress = 0;
|
||||
}
|
||||
return MapViewOfFileEx(hFileMappingObject, dwDesiredAccess, dwFileOffsetHigh,
|
||||
dwFileOffsetLow, dwNumberOfBytesToMap, lpBaseAddress);
|
||||
}
|
111
apilibs/kexbases/Kernel32/MoveFileExA.c
Normal file
111
apilibs/kexbases/Kernel32/MoveFileExA.c
Normal file
@ -0,0 +1,111 @@
|
||||
/*************************************************************************
|
||||
*
|
||||
* OpenOffice.org - a multi-platform office productivity suite
|
||||
*
|
||||
* $RCSfile: MoveFileExA.cpp,v $
|
||||
*
|
||||
* $Revision: 1.4 $
|
||||
*
|
||||
* last change: $Author: rt $ $Date: 2005/09/08 16:21:23 $
|
||||
*
|
||||
* The Contents of this file are made available subject to
|
||||
* the terms of GNU Lesser General Public License Version 2.1.
|
||||
*
|
||||
*
|
||||
* GNU Lesser General Public License Version 2.1
|
||||
* =============================================
|
||||
* Copyright 2005 by Sun Microsystems, Inc.
|
||||
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* 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., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
************************************************************************/
|
||||
|
||||
//#include "macros.h"
|
||||
#include <windows.h>
|
||||
|
||||
#define WININIT_FILENAME "wininit.ini"
|
||||
#define RENAME_SECTION "rename"
|
||||
#define BUFSIZE 32767
|
||||
|
||||
/* MAKE_EXPORT MoveFileExA_new=MoveFileExA */
|
||||
BOOL WINAPI MoveFileExA_new( LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags )
|
||||
{
|
||||
BOOL fSuccess = FALSE; // assume failure
|
||||
|
||||
// Windows 9x has a special mechanism to move files after reboot
|
||||
|
||||
if ( dwFlags & MOVEFILE_DELAY_UNTIL_REBOOT )
|
||||
{
|
||||
CHAR szExistingFileNameA[MAX_PATH];
|
||||
CHAR szNewFileNameA[MAX_PATH];
|
||||
lstrcpyA( szNewFileNameA, "NUL" );
|
||||
|
||||
// Path names in WININIT.INI must be in short path name form
|
||||
|
||||
if (
|
||||
GetShortPathNameA( lpExistingFileNameA, szExistingFileNameA, MAX_PATH ) &&
|
||||
(!lpNewFileNameA || GetShortPathNameA( lpNewFileNameA, szNewFileNameA, MAX_PATH ))
|
||||
)
|
||||
{
|
||||
CHAR* szBuffer = (CHAR*) HeapAlloc( GetProcessHeap(), 0, BUFSIZE ); // The buffer size must not exceed 32K
|
||||
DWORD dwBufLen = GetPrivateProfileSectionA( RENAME_SECTION, szBuffer, BUFSIZE, WININIT_FILENAME );
|
||||
|
||||
CHAR szRename[MAX_PATH]; // This is enough for at most to times 67 chracters
|
||||
size_t lnRename;
|
||||
lstrcpyA( szRename, szNewFileNameA );
|
||||
lstrcatA( szRename, "=" );
|
||||
lstrcatA( szRename, szExistingFileNameA );
|
||||
lnRename = lstrlenA(szRename);
|
||||
|
||||
if ( dwBufLen + lnRename + 2 <= BUFSIZE )
|
||||
{
|
||||
lstrcpyA( &szBuffer[dwBufLen], szRename );
|
||||
szBuffer[ dwBufLen + lnRename + 1 ] = 0;
|
||||
|
||||
fSuccess = WritePrivateProfileSectionA( RENAME_SECTION, szBuffer, WININIT_FILENAME );
|
||||
}
|
||||
else
|
||||
SetLastError( ERROR_BUFFER_OVERFLOW );
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, szBuffer );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
fSuccess = MoveFileA( lpExistingFileNameA, lpNewFileNameA );
|
||||
|
||||
if ( !fSuccess && 0 != (dwFlags & (MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) )
|
||||
{
|
||||
BOOL bFailIfExist = 0 == (dwFlags & MOVEFILE_REPLACE_EXISTING);
|
||||
|
||||
fSuccess = CopyFileA( lpExistingFileNameA, lpNewFileNameA, bFailIfExist );
|
||||
|
||||
// In case of successfull copy do not return FALSE if delete fails.
|
||||
// Error detection is done by GetLastError()
|
||||
|
||||
if ( fSuccess )
|
||||
{
|
||||
SetLastError( NO_ERROR );
|
||||
DeleteFileA( lpExistingFileNameA );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return fSuccess;
|
||||
}
|
||||
|
28
apilibs/kexbases/Kernel32/MoveFileWithProgressA.c
Normal file
28
apilibs/kexbases/Kernel32/MoveFileWithProgressA.c
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT MoveFileWithProgressA_new=MoveFileWithProgressA */
|
||||
BOOL WINAPI MoveFileWithProgressA_new(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags)
|
||||
{
|
||||
return MoveFileExA(lpExistingFileName, lpNewFileName, dwFlags);
|
||||
}
|
60
apilibs/kexbases/Kernel32/OpenThread.c
Normal file
60
apilibs/kexbases/Kernel32/OpenThread.c
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
typedef HANDLE (__stdcall *AllocHandle_t)(void* current_pdb, void* tdb, DWORD access);
|
||||
AllocHandle_t AllocHandle = NULL;
|
||||
|
||||
BOOL init_openthread()
|
||||
{
|
||||
int i;
|
||||
DWORD addr = (DWORD) kexGetProcAddress(GetModuleHandle("kernel32"), "OpenProcess");
|
||||
for (i = 0 ; i < 100 ; i++, addr++)
|
||||
if (*(DWORD*) addr == 0xe832ff50)
|
||||
{
|
||||
addr += 4;
|
||||
AllocHandle = (AllocHandle_t)(addr + 4 + *(DWORD*)addr);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT OpenThread_new=OpenThread */
|
||||
HANDLE WINAPI OpenThread_new(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId)
|
||||
{
|
||||
HANDLE ret;
|
||||
BYTE* tdb = (BYTE*) kexTIDtoTDB(dwThreadId);
|
||||
if (!tdb || *tdb != 7)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dwDesiredAccess &= THREAD_ALL_ACCESS;
|
||||
if (bInheritHandle)
|
||||
dwDesiredAccess |= 0x80000000;
|
||||
ret = AllocHandle(kexPIDtoPDB(GetCurrentProcessId()), tdb, dwDesiredAccess);
|
||||
if (ret == INVALID_HANDLE_VALUE)
|
||||
return NULL;
|
||||
return ret;
|
||||
}
|
40
apilibs/kexbases/Kernel32/SetFilePointerEx.c
Normal file
40
apilibs/kexbases/Kernel32/SetFilePointerEx.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2006, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef INVALID_SET_FILE_POINTER
|
||||
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
|
||||
#endif
|
||||
|
||||
/* MAKE_EXPORT SetFilePointerEx_new=SetFilePointerEx */
|
||||
BOOL WINAPI SetFilePointerEx_new(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
|
||||
{
|
||||
DWORD lasterr = GetLastError();
|
||||
if ((liDistanceToMove.LowPart = SetFilePointer(hFile, liDistanceToMove.LowPart, &liDistanceToMove.HighPart, dwMoveMethod)) == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (lpNewFilePointer) *lpNewFilePointer = liDistanceToMove;
|
||||
SetLastError(lasterr);
|
||||
return TRUE;
|
||||
}
|
51
apilibs/kexbases/Kernel32/ThreadPool.c
Normal file
51
apilibs/kexbases/Kernel32/ThreadPool.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* COMPLETE SHIT. PORT WINE HERE */
|
||||
|
||||
/* MAKE_EXPORT RegisterWaitForSingleObject_new=RegisterWaitForSingleObject */
|
||||
BOOL WINAPI RegisterWaitForSingleObject_new(PHANDLE phNewWaitObject, HANDLE hObject, PVOID Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT RegisterWaitForSingleObjectEx_new=RegisterWaitForSingleObjectEx */
|
||||
HANDLE WINAPI RegisterWaitForSingleObjectEx_new(HANDLE hObject,
|
||||
PVOID Callback, PVOID Context,
|
||||
ULONG dwMilliseconds, ULONG dwFlags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT UnregisterWait_new=UnregisterWait */
|
||||
BOOL WINAPI UnregisterWait_new(HANDLE WaitHandle)
|
||||
{
|
||||
return WaitHandle != 0;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT UnregisterWaitEx_new=UnregisterWaitEx */
|
||||
BOOL WINAPI UnregisterWaitEx_new(HANDLE WaitHandle, HANDLE CompletionEvent)
|
||||
{
|
||||
return WaitHandle != 0;
|
||||
}
|
152
apilibs/kexbases/Kernel32/TryEnterCriticalSection.c
Normal file
152
apilibs/kexbases/Kernel32/TryEnterCriticalSection.c
Normal file
@ -0,0 +1,152 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
#define K32OBJ_CRITICAL_SECTION 4
|
||||
|
||||
typedef struct _CRIT_SECT // Size = 0x20
|
||||
{
|
||||
BYTE Type; // 00 = 4: K32_OBJECT_CRITICAL_SECTION
|
||||
int RecursionCount; // 04 initially 0, incremented on lock
|
||||
void* OwningThread; // 08 pointer to TDBX
|
||||
DWORD un3; // 0C
|
||||
int LockCount; // 10 initially 1, decremented on lock
|
||||
struct _CRIT_SECT* Next; // 14
|
||||
void* PLst; // 18 list of processes using it?
|
||||
struct _WIN_CRITICAL_SECTION* UserCS; // 1C pointer to user defined CRITICAL_SECTION
|
||||
} CRIT_SECT, *PCRIT_SECT;
|
||||
|
||||
typedef struct _WIN_CRITICAL_SECTION
|
||||
{
|
||||
BYTE Type; //= 4: K32_OBJECT_CRITICAL_SECTION
|
||||
PCRIT_SECT crit;
|
||||
DWORD un1;
|
||||
DWORD un2;
|
||||
DWORD un3;
|
||||
DWORD un4;
|
||||
} WIN_CRITICAL_SECTION, *PWIN_CRITICAL_SECTION;
|
||||
|
||||
static DWORD _offset;
|
||||
|
||||
BOOL init_tryentercritsec()
|
||||
{
|
||||
DWORD GV = kexGetVersion();
|
||||
|
||||
if (GV == 0xc0000a04) //98
|
||||
{
|
||||
_offset = 0x58 - 0x8;
|
||||
return TRUE;
|
||||
}
|
||||
if (GV == 0xc0005a04) //Me
|
||||
{
|
||||
_offset = 0x88 - 0x8;
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
BOOL WINAPI TryEnterCrst(CRIT_SECT* crit);
|
||||
|
||||
__asm__(".text\n\t"
|
||||
".align 4\n\t"
|
||||
".globl _TryEnterCrst@4\n\t"
|
||||
".def _TryEnterCrst@4; .scl 2; .type 32; .endef\n"
|
||||
"_TryEnterCrst@4:\n\t"
|
||||
"movl 4(%esp),%edx\n\t"
|
||||
"xorl %eax,%eax\n\t"
|
||||
"incl %eax\n\t"
|
||||
"xorl %ecx,%ecx\n\t"
|
||||
"cmpxchgl %ecx,0x10(%edx)\n\t" /* if (OP1==eax) { OP1=OP2; ZF=1; } else { eax=OP1; ZF=0 } */
|
||||
"movl %fs:0x18, %ecx\n\t"
|
||||
"addl _offset,%ecx\n\t"
|
||||
"movl (%ecx),%ecx\n\t" /* ecx will contain TDBX now */
|
||||
"cmpl $1,%eax\n\t"
|
||||
"jnz .L1\n\t"
|
||||
/* critical section was unowned => successful lock */
|
||||
"movl %ecx,8(%edx)\n\t"
|
||||
"incl 4(%edx)\n\t"
|
||||
"ret $4\n\t"
|
||||
".L1: \n\t"
|
||||
"cmpl %ecx,8(%edx)\n\t"
|
||||
"jnz .L2\n\t"
|
||||
/* critical section owned by this thread */
|
||||
"decl 0x10(%edx)\n\t"
|
||||
"incl 4(%edx)\n\t"
|
||||
"xorl %eax,%eax\n\t"
|
||||
"incl %eax\n\t"
|
||||
"ret $4\n\t"
|
||||
".L2: \n\t"
|
||||
/* critical section owned by other thread - do nothing */
|
||||
"xorl %eax,%eax\n\t"
|
||||
"ret $4\n\t"
|
||||
);
|
||||
|
||||
#else
|
||||
|
||||
__declspec(naked) BOOL WINAPI TryEnterCrst(CRIT_SECT* crit)
|
||||
{
|
||||
__asm {
|
||||
mov edx, [esp+4]
|
||||
xor eax, eax
|
||||
inc eax
|
||||
xor ecx, ecx
|
||||
cmpxchg [edx+10h], ecx ;if (OP1==eax) { OP1=OP2; ZF=1; } else { eax=OP1; ZF=0 }
|
||||
;mov ecx, ppTDBXCur
|
||||
mov ecx, fs:[18h]
|
||||
add ecx, [_offset]
|
||||
mov ecx, [ecx] ;ecx will contain TDBX now
|
||||
cmp eax, 1
|
||||
jnz L1
|
||||
;critical section was unowned => successful lock
|
||||
mov [edx+8], ecx
|
||||
inc dword ptr [edx+4]
|
||||
ret 4
|
||||
L1:
|
||||
cmp [edx+8], ecx
|
||||
jnz L2
|
||||
;critical section owned by this thread
|
||||
dec dword ptr [edx+10h]
|
||||
inc dword ptr [edx+4]
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret 4
|
||||
L2:
|
||||
;critical section owned by other thread - do nothing
|
||||
xor eax, eax
|
||||
ret 4
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* MAKE_EXPORT TryEnterCriticalSection_new=TryEnterCriticalSection */
|
||||
BOOL WINAPI TryEnterCriticalSection_new(CRITICAL_SECTION* cs)
|
||||
{
|
||||
WIN_CRITICAL_SECTION* mycs = (WIN_CRITICAL_SECTION*) cs;
|
||||
if (mycs->Type != K32OBJ_CRITICAL_SECTION)
|
||||
RaiseException(STATUS_ACCESS_VIOLATION, 0, 0, NULL);
|
||||
|
||||
return TryEnterCrst(mycs->crit);
|
||||
}
|
41
apilibs/kexbases/Kernel32/VirtualAllocEx.c
Normal file
41
apilibs/kexbases/Kernel32/VirtualAllocEx.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#ifndef VA_SHARED
|
||||
#define VA_SHARED 0x8000000
|
||||
#endif
|
||||
|
||||
/* MAKE_EXPORT VirtualAllocEx_new=VirtualAllocEx */
|
||||
LPVOID WINAPI VirtualAllocEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect)
|
||||
{
|
||||
if (hProcess != GetCurrentProcess())
|
||||
//if (GetProcessID(hProcess) != GetCurrentProcessId())
|
||||
flAllocationType |= VA_SHARED;
|
||||
return VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VirtualFreeEx_new=VirtualFreeEx */
|
||||
BOOL WINAPI VirtualFreeEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType)
|
||||
{
|
||||
return VirtualFree(lpAddress, dwSize, dwFreeType);
|
||||
}
|
194
apilibs/kexbases/Kernel32/_kernel32_apilist.c
Normal file
194
apilibs/kexbases/Kernel32/_kernel32_apilist.c
Normal file
@ -0,0 +1,194 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/*TODOS:
|
||||
CreateRemoteThread
|
||||
http://17slon.com/blogs/gabr/2007/02/four-ways-to-detect-vista.html
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_kernel32_apilist.h"
|
||||
|
||||
BOOL init_tryentercritsec();
|
||||
BOOL init_openthread();
|
||||
|
||||
BOOL init_kernel32()
|
||||
{
|
||||
return init_tryentercritsec() && init_openthread();
|
||||
}
|
||||
|
||||
/*
|
||||
* MAKE_EXPORT GetWindowsDirectoryA=GetSystemWindowsDirectoryA
|
||||
* MAKE_EXPORT GetWindowsDirectoryW=GetSystemWindowsDirectoryW
|
||||
* MAKE_EXPORT GetSystemInfo=GetNativeSystemInfo
|
||||
* MAKE_EXPORT SetLastError=RestoreLastError
|
||||
*/
|
||||
|
||||
static const apilib_named_api kernel32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("AddAtomW", AddAtomW_new),
|
||||
DECL_API("AssignProcessToJobObject", AssignProcessToJobObject_new),
|
||||
DECL_API("CopyFileExA", CopyFileExA_new),
|
||||
DECL_API("CopyFileExW", CopyFileExW_new),
|
||||
DECL_API("CopyFileW", CopyFileW_new),
|
||||
DECL_API("CreateDirectoryExW", CreateDirectoryExW_new),
|
||||
DECL_API("CreateDirectoryW", CreateDirectoryW_new),
|
||||
DECL_API("CreateFileA", CreateFileA_fix),
|
||||
DECL_API("CreateFileW", CreateFileW_new),
|
||||
DECL_API("CreateHardLinkA", CreateHardLinkA_stub),
|
||||
DECL_API("CreateHardLinkW", CreateHardLinkW_stub),
|
||||
DECL_API("CreateJobObjectA", CreateJobObjectA_new),
|
||||
DECL_API("CreateJobObjectW", CreateJobObjectW_new),
|
||||
DECL_API("CreateThread", CreateThread_fix),
|
||||
DECL_API("DefineDosDeviceW", DefineDosDeviceW_new),
|
||||
DECL_API("DeleteCriticalSection", DeleteCriticalSection_new),
|
||||
DECL_API("DeleteFileW", DeleteFileW_new),
|
||||
DECL_API("EnumUILanguagesA", EnumUILanguagesA_new),
|
||||
DECL_API("EnumUILanguagesW", EnumUILanguagesW_new),
|
||||
DECL_API("FindAtomW", FindAtomW_new),
|
||||
DECL_API("FindFirstChangeNotificationW", FindFirstChangeNotificationW_new),
|
||||
DECL_API("FindFirstFileExW", FindFirstFileExW_stub),
|
||||
DECL_API("FindFirstFileW", FindFirstFileW_new),
|
||||
DECL_API("FindNextFileW", FindNextFileW_new),
|
||||
DECL_API("FindResourceExW", FindResourceExW_new),
|
||||
DECL_API("FindResourceW", FindResourceW_new),
|
||||
DECL_API("FreeEnvironmentStringsW", FreeEnvironmentStringsW_new),
|
||||
DECL_API("GetConsoleWindow", GetConsoleWindow_stub),
|
||||
DECL_API("GetCurrentDirectoryW", GetCurrentDirectoryW_new),
|
||||
DECL_API("GetDefaultCommConfigW", GetDefaultCommConfigW_new),
|
||||
DECL_API("GetDiskFreeSpaceExW", GetDiskFreeSpaceExW_new),
|
||||
DECL_API("GetDiskFreeSpaceW", GetDiskFreeSpaceW_new),
|
||||
DECL_API("GetEnvironmentStringsW", GetEnvironmentStringsW_new),
|
||||
DECL_API("GetFileAttributesExW", GetFileAttributesExW_new),
|
||||
DECL_API("GetFileAttributesW", GetFileAttributesW_new),
|
||||
DECL_API("GetFileSizeEx", GetFileSizeEx_new),
|
||||
DECL_API("GetFullPathNameW", GetFullPathNameW_new),
|
||||
DECL_API("GetLongPathNameW", GetLongPathNameW_new),
|
||||
DECL_API("GetNativeSystemInfo", GetSystemInfo),
|
||||
DECL_API("GetShortPathNameW", GetShortPathNameW_new),
|
||||
DECL_API("GetStartupInfoW", GetStartupInfoW_new),
|
||||
DECL_API("GetSystemDefaultUILanguage", GetSystemDefaultUILanguage_new),
|
||||
DECL_API("GetSystemDirectoryW", GetSystemDirectoryW_new),
|
||||
DECL_API("GetSystemWindowsDirectoryA", GetWindowsDirectoryA),
|
||||
DECL_API("GetSystemWindowsDirectoryW", GetWindowsDirectoryW),
|
||||
DECL_API("GetTempFileNameW", GetTempFileNameW_new),
|
||||
DECL_API("GetTempPathW", GetTempPathW_new),
|
||||
DECL_API("GetUserDefaultUILanguage", GetUserDefaultUILanguage_new),
|
||||
DECL_API("GetVersion", GetVersion_WIN95),
|
||||
DECL_API("GetVersion", GetVersion_WIN98),
|
||||
DECL_API("GetVersion", GetVersion_WINME),
|
||||
DECL_API("GetVersion", GetVersion_NT40),
|
||||
DECL_API("GetVersion", GetVersion_NT2K),
|
||||
DECL_API("GetVersion", GetVersion_WINXP),
|
||||
DECL_API("GetVersion", GetVersion_WIN2K3),
|
||||
DECL_API("GetVersion", GetVersion_VISTA),
|
||||
DECL_API("GetVersion", GetVersion_WIN2K8),
|
||||
DECL_API("GetVersionExA", GetVersionExA_WIN95),
|
||||
DECL_API("GetVersionExA", GetVersionExA_WIN98),
|
||||
DECL_API("GetVersionExA", GetVersionExA_WINME),
|
||||
DECL_API("GetVersionExA", GetVersionExA_NT40),
|
||||
DECL_API("GetVersionExA", GetVersionExA_NT2K),
|
||||
DECL_API("GetVersionExA", GetVersionExA_WINXP),
|
||||
DECL_API("GetVersionExA", GetVersionExA_WIN2K3),
|
||||
DECL_API("GetVersionExA", GetVersionExA_VISTA),
|
||||
DECL_API("GetVersionExA", GetVersionExA_WIN2K8),
|
||||
DECL_API("GetVersionExW", GetVersionExW_WIN95),
|
||||
DECL_API("GetVersionExW", GetVersionExW_WIN98),
|
||||
DECL_API("GetVersionExW", GetVersionExW_WINME),
|
||||
DECL_API("GetVersionExW", GetVersionExW_NT40),
|
||||
DECL_API("GetVersionExW", GetVersionExW_NT2K),
|
||||
DECL_API("GetVersionExW", GetVersionExW_WINXP),
|
||||
DECL_API("GetVersionExW", GetVersionExW_WIN2K3),
|
||||
DECL_API("GetVersionExW", GetVersionExW_VISTA),
|
||||
DECL_API("GetVersionExW", GetVersionExW_WIN2K8),
|
||||
DECL_API("GetWindowsDirectoryW", GetWindowsDirectoryW_new),
|
||||
DECL_API("GlobalAddAtomW", GlobalAddAtomW_new),
|
||||
DECL_API("GlobalFindAtomW", GlobalFindAtomW_new),
|
||||
DECL_API("GlobalGetAtomNameW", GlobalGetAtomNameW_new),
|
||||
DECL_API("GlobalMemoryStatusEx", GlobalMemoryStatusEx_new),
|
||||
DECL_API("HeapLock", HeapLock_new),
|
||||
DECL_API("HeapUnlock", HeapUnlock_new),
|
||||
DECL_API("InitializeCriticalSectionAndSpinCount", InitializeCriticalSectionAndSpinCount_new),
|
||||
DECL_API("IsProcessInJob", IsProcessInJob_new),
|
||||
DECL_API("IsValidLanguageGroup", IsValidLanguageGroup_stub),
|
||||
DECL_API("KEXVersion", KEXVersion),
|
||||
DECL_API("LockFileEx", LockFileEx_new),
|
||||
DECL_API("MapViewOfFileEx", MapViewOfFileEx_new),
|
||||
DECL_API("Module32FirstW", Module32FirstW_new),
|
||||
DECL_API("Module32NextW", Module32NextW_new),
|
||||
DECL_API("MoveFileExA", MoveFileExA_new),
|
||||
DECL_API("MoveFileExW", MoveFileExW_new),
|
||||
DECL_API("MoveFileW", MoveFileW_new),
|
||||
DECL_API("MoveFileWithProgressA", MoveFileWithProgressA_new),
|
||||
DECL_API("MoveFileWithProgressW", MoveFileWithProgressW_new),
|
||||
DECL_API("OpenJobObjectA", OpenJobObjectA_new),
|
||||
DECL_API("OpenJobObjectW", OpenJobObjectW_new),
|
||||
DECL_API("OpenThread", OpenThread_new),
|
||||
DECL_API("OutputDebugStringW", OutputDebugStringW_new),
|
||||
DECL_API("Process32FirstW", Process32FirstW_new),
|
||||
DECL_API("Process32NextW", Process32NextW_new),
|
||||
DECL_API("QueryInformationJobObject", QueryInformationJobObject_new),
|
||||
DECL_API("QueueUserWorkItem", QueueUserWorkItem_stub),
|
||||
DECL_API("RegisterWaitForSingleObject", RegisterWaitForSingleObject_new),
|
||||
DECL_API("RegisterWaitForSingleObjectEx", RegisterWaitForSingleObjectEx_new),
|
||||
DECL_API("RemoveDirectoryW", RemoveDirectoryW_new),
|
||||
DECL_API("ReplaceFileA", ReplaceFileA_stub),
|
||||
DECL_API("ReplaceFileW", ReplaceFileW_stub),
|
||||
DECL_API("RestoreLastError", SetLastError),
|
||||
DECL_API("SearchPathW", SearchPathW_new),
|
||||
DECL_API("SetConsoleTitleW", SetConsoleTitleW_new),
|
||||
DECL_API("SetCurrentDirectoryW", SetCurrentDirectoryW_new),
|
||||
DECL_API("SetFileAttributesW", SetFileAttributesW_new),
|
||||
DECL_API("SetFilePointerEx", SetFilePointerEx_new),
|
||||
DECL_API("SetInformationJobObject", SetInformationJobObject_new),
|
||||
DECL_API("TerminateJobObject", TerminateJobObject_new),
|
||||
DECL_API("TryEnterCriticalSection", TryEnterCriticalSection_new),
|
||||
DECL_API("UnregisterWait", UnregisterWait_new),
|
||||
DECL_API("UnregisterWaitEx", UnregisterWaitEx_new),
|
||||
DECL_API("VerLanguageNameW", VerLanguageNameW_new),
|
||||
DECL_API("VerSetConditionMask", VerSetConditionMask_new),
|
||||
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_NT2K),
|
||||
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_WINXP),
|
||||
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_WIN2K3),
|
||||
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_VISTA),
|
||||
DECL_API("VerifyVersionInfoA", VerifyVersionInfoA_WIN2K8),
|
||||
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_NT2K),
|
||||
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_WINXP),
|
||||
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_WIN2K3),
|
||||
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_VISTA),
|
||||
DECL_API("VerifyVersionInfoW", VerifyVersionInfoW_WIN2K8),
|
||||
DECL_API("VirtualAllocEx", VirtualAllocEx_new),
|
||||
DECL_API("VirtualFreeEx", VirtualFreeEx_new),
|
||||
DECL_API("lstrcpynW", lstrcpynW_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api kernel32_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_kernel32 = DECL_TAB("KERNEL32.DLL", kernel32_named_apis, 0 /*kernel32_ordinal_apis*/);
|
165
apilibs/kexbases/Kernel32/_kernel32_apilist.h
Normal file
165
apilibs/kexbases/Kernel32/_kernel32_apilist.h
Normal file
@ -0,0 +1,165 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _KERNEL32_APILIST_H
|
||||
#define _KERNEL32_APILIST_H
|
||||
|
||||
#include "auxdecl.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include <tlhelp32.h>
|
||||
|
||||
BOOL init_kernel32();
|
||||
extern const apilib_api_table apitable_kernel32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
BOOL WINAPI CopyFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags);
|
||||
HANDLE WINAPI CreateFileA_fix(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDistribution, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
|
||||
HANDLE WINAPI CreateThread_fix(LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
|
||||
void WINAPI DeleteCriticalSection_new(PCRITICAL_SECTION lpCriticalSection);
|
||||
BOOL WINAPI GetFileSizeEx_new(HANDLE hFile, PLARGE_INTEGER lpFileSize);
|
||||
BOOL WINAPI GlobalMemoryStatusEx_new(LPMEMORYSTATUSEX lpmemex);
|
||||
BOOL WINAPI HeapLock_new(HANDLE hHeap);
|
||||
BOOL WINAPI HeapUnlock_new(HANDLE hHeap);
|
||||
BOOL WINAPI InitializeCriticalSectionAndSpinCount_new(LPCRITICAL_SECTION lpCriticalSection, DWORD dwSpinCount);
|
||||
HANDLE WINAPI CreateJobObjectA_new(LPSECURITY_ATTRIBUTES sa, LPCSTR name);
|
||||
HANDLE WINAPI CreateJobObjectW_new(LPSECURITY_ATTRIBUTES sa, LPCWSTR name);
|
||||
BOOL WINAPI TerminateJobObject_new(HANDLE job, UINT exit_code);
|
||||
HANDLE WINAPI OpenJobObjectA_new(DWORD access, BOOL inherit, LPCSTR name);
|
||||
HANDLE WINAPI OpenJobObjectW_new(DWORD access, BOOL inherit, LPCWSTR name);
|
||||
BOOL WINAPI QueryInformationJobObject_new(HANDLE job, PVOID classs, LPVOID info, DWORD len, DWORD *ret_len);
|
||||
BOOL WINAPI SetInformationJobObject_new(HANDLE job, PVOID classs, LPVOID info, DWORD len);
|
||||
BOOL WINAPI AssignProcessToJobObject_new(HANDLE job, HANDLE process);
|
||||
BOOL WINAPI IsProcessInJob_new(HANDLE process, HANDLE job, PBOOL result);
|
||||
void WINAPI KEXVersion(char* out);
|
||||
BOOL WINAPI LockFileEx_new(HANDLE hFile, DWORD dwFlags, DWORD dwReserved, DWORD nNumberOfBytesToLockLow, DWORD nNumberOfBytesToLockHigh, LPOVERLAPPED lpOverlapped);
|
||||
LPVOID WINAPI MapViewOfFileEx_new(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap, LPVOID lpBaseAddress);
|
||||
BOOL WINAPI MoveFileExA_new(LPCSTR lpExistingFileNameA, LPCSTR lpNewFileNameA, DWORD dwFlags);
|
||||
BOOL WINAPI MoveFileWithProgressA_new(LPCSTR lpExistingFileName, LPCSTR lpNewFileName, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags);
|
||||
HANDLE WINAPI OpenThread_new(DWORD dwDesiredAccess, BOOL bInheritHandle, DWORD dwThreadId);
|
||||
BOOL WINAPI SetFilePointerEx_new(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod);
|
||||
BOOL WINAPI RegisterWaitForSingleObject_new(PHANDLE phNewWaitObject, HANDLE hObject, PVOID Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags);
|
||||
HANDLE WINAPI RegisterWaitForSingleObjectEx_new(HANDLE hObject, PVOID Callback, PVOID Context, ULONG dwMilliseconds, ULONG dwFlags);
|
||||
BOOL WINAPI UnregisterWait_new(HANDLE WaitHandle);
|
||||
BOOL WINAPI UnregisterWaitEx_new(HANDLE WaitHandle, HANDLE CompletionEvent);
|
||||
BOOL WINAPI TryEnterCriticalSection_new(CRITICAL_SECTION* cs);
|
||||
LPVOID WINAPI VirtualAllocEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD flAllocationType, DWORD flProtect);
|
||||
BOOL WINAPI VirtualFreeEx_new(HANDLE hProcess, LPVOID lpAddress, DWORD dwSize, DWORD dwFreeType);
|
||||
STUB CreateHardLinkA_stub;
|
||||
STUB CreateHardLinkW_stub;
|
||||
STUB GetConsoleWindow_stub;
|
||||
STUB IsValidLanguageGroup_stub;
|
||||
STUB QueueUserWorkItem_stub;
|
||||
STUB ReplaceFileA_stub;
|
||||
STUB ReplaceFileW_stub;
|
||||
STUB FindFirstFileExW_stub;
|
||||
LANGID WINAPI GetUserDefaultUILanguage_new(void);
|
||||
LANGID WINAPI GetSystemDefaultUILanguage_new(void);
|
||||
BOOL WINAPI EnumUILanguagesA_new(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam);
|
||||
BOOL WINAPI EnumUILanguagesW_new(UILANGUAGE_ENUMPROCW pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam);
|
||||
ATOM WINAPI AddAtomW_new(LPCWSTR strW);
|
||||
BOOL WINAPI CopyFileExW_new(LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags);
|
||||
BOOL WINAPI CopyFileW_new(LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, BOOL bFailIfExists);
|
||||
BOOL WINAPI CreateDirectoryExW_new(LPCWSTR templatedirW, LPCWSTR newdirW, LPSECURITY_ATTRIBUTES secattr);
|
||||
BOOL WINAPI CreateDirectoryW_new(LPCWSTR PathW, LPSECURITY_ATTRIBUTES SecAttr);
|
||||
HANDLE WINAPI CreateFileW_new(LPCWSTR strW, DWORD access, DWORD sharemode, LPSECURITY_ATTRIBUTES secattr, DWORD creatdistr, DWORD flags, HANDLE temp);
|
||||
BOOL WINAPI DefineDosDeviceW_new(DWORD dwFlags, LPCWSTR lpDeviceNameW, LPCWSTR lpTargetPathW);
|
||||
BOOL WINAPI DeleteFileW_new(LPCWSTR lpFileNameW);
|
||||
ATOM WINAPI FindAtomW_new(LPCWSTR strW);
|
||||
HANDLE WINAPI FindFirstChangeNotificationW_new(LPCWSTR pathW, BOOL watchsubtree, DWORD filter);
|
||||
HANDLE WINAPI FindFirstFileW_new(LPCWSTR strW, LPWIN32_FIND_DATAW dataW);
|
||||
BOOL WINAPI FindNextFileW_new(HANDLE handle, LPWIN32_FIND_DATAW dataW);
|
||||
HRSRC WINAPI FindResourceExW_new(HMODULE hModule, LPCWSTR typeW, LPCWSTR nameW, WORD lang);
|
||||
HRSRC WINAPI FindResourceW_new(HINSTANCE hModule, LPCWSTR name, LPCWSTR type);
|
||||
BOOL WINAPI FreeEnvironmentStringsW_new(void* env);
|
||||
DWORD WINAPI GetCurrentDirectoryW_new(DWORD nBufferLength, LPWSTR lpBufferW);
|
||||
BOOL WINAPI GetDefaultCommConfigW_new(LPCWSTR lpszNameW, LPCOMMCONFIG lpCC, LPDWORD lpdwSize);
|
||||
BOOL WINAPI GetDiskFreeSpaceExW_new(LPCWSTR lpDirectoryNameW, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes);
|
||||
BOOL WINAPI GetDiskFreeSpaceW_new(LPCWSTR lpRootPathNameW, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters);
|
||||
void* WINAPI GetEnvironmentStringsW_new(void);
|
||||
BOOL WINAPI GetFileAttributesExW_new(LPCWSTR lpFileNameW, GET_FILEEX_INFO_LEVELS fInfoLevelId, LPVOID lpFileInformation);
|
||||
DWORD WINAPI GetFileAttributesW_new(LPCWSTR lpFileNameW);
|
||||
DWORD WINAPI GetFullPathNameW_new(LPCWSTR lpFileNameW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW);
|
||||
DWORD WINAPI GetLongPathNameW_new(LPCWSTR lpszShortPathW, LPWSTR lpszLongPathW, DWORD cchBuffer);
|
||||
DWORD WINAPI GetShortPathNameW_new(LPCWSTR lpszLongPathW, LPWSTR lpszShortPathW, DWORD cchBuffer);
|
||||
VOID WINAPI GetStartupInfoW_new(LPSTARTUPINFOW lpStartupInfo);
|
||||
UINT WINAPI GetSystemDirectoryW_new(LPWSTR lpBufferW, UINT uSize);
|
||||
UINT WINAPI GetTempFileNameW_new(LPCWSTR lpPathNameW, LPCWSTR lpPrefixStringW, UINT uUnique, LPWSTR lpTempFileNameW);
|
||||
DWORD WINAPI GetTempPathW_new(DWORD nBufferLength, LPWSTR lpBufferW);
|
||||
UINT WINAPI GetWindowsDirectoryW_new(LPWSTR lpBufferW, UINT uSize);
|
||||
ATOM WINAPI GlobalAddAtomW_new(LPCWSTR strW);
|
||||
ATOM WINAPI GlobalFindAtomW_new(LPCWSTR strW);
|
||||
UINT WINAPI GlobalGetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size);
|
||||
BOOL WINAPI Module32FirstW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW);
|
||||
BOOL WINAPI Module32NextW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW);
|
||||
BOOL WINAPI MoveFileExW_new(LPCWSTR existingfileW, LPCWSTR newfileW, DWORD flags);
|
||||
BOOL WINAPI MoveFileW_new(LPCWSTR existingfileW, LPCWSTR newfileW);
|
||||
BOOL WINAPI MoveFileWithProgressW_new(LPCWSTR existingfileW, LPCWSTR newfileW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags);
|
||||
void WINAPI OutputDebugStringW_new(LPCWSTR strW);
|
||||
BOOL WINAPI Process32FirstW_new(HANDLE hSnapshot, LPPROCESSENTRY32W lppeW);
|
||||
BOOL WINAPI Process32NextW_new(HANDLE hSnapshot, LPPROCESSENTRY32W lppeW);
|
||||
BOOL WINAPI RemoveDirectoryW_new(LPCWSTR lpPathNameW);
|
||||
DWORD WINAPI SearchPathW_new(LPCWSTR lpPathW, LPCWSTR lpFileNameW, LPCWSTR lpExtensionW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW);
|
||||
BOOL WINAPI SetConsoleTitleW_new(LPCWSTR strW);
|
||||
BOOL WINAPI SetCurrentDirectoryW_new(LPCWSTR lpPathNameW);
|
||||
BOOL WINAPI SetFileAttributesW_new(LPCWSTR lpFileNameW, DWORD dwFileAttributes);
|
||||
DWORD WINAPI VerLanguageNameW_new(DWORD wLang, LPWSTR szLangW, DWORD nSize);
|
||||
LPWSTR WINAPI lstrcpynW_new(LPWSTR dst, LPCWSTR src, INT n);
|
||||
ULONGLONG WINAPI VerSetConditionMask_new(ULONGLONG dwlConditionMask, DWORD dwTypeBitMask, BYTE dwConditionMask);
|
||||
DWORD WINAPI GetVersion_WIN95(void);
|
||||
DWORD WINAPI GetVersion_WIN98(void);
|
||||
DWORD WINAPI GetVersion_WINME(void);
|
||||
DWORD WINAPI GetVersion_NT40(void);
|
||||
DWORD WINAPI GetVersion_NT2K(void);
|
||||
DWORD WINAPI GetVersion_WINXP(void);
|
||||
DWORD WINAPI GetVersion_WIN2K3(void);
|
||||
DWORD WINAPI GetVersion_VISTA(void);
|
||||
DWORD WINAPI GetVersion_WIN2K8(void);
|
||||
BOOL WINAPI GetVersionExA_WIN95(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_WIN95(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExA_WIN98(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_WIN98(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExA_WINME(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_WINME(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExA_NT40(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_NT40(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExA_NT2K(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_NT2K(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExA_WINXP(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_WINXP(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExA_WIN2K3(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_WIN2K3(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExA_VISTA(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_VISTA(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExA_WIN2K8(LPOSVERSIONINFOA lpVersionInfo);
|
||||
BOOL WINAPI GetVersionExW_WIN2K8(LPOSVERSIONINFOW lpVersionInfo);
|
||||
BOOL WINAPI VerifyVersionInfoA_NT2K(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoW_NT2K(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoA_WINXP(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoW_WINXP(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoA_WIN2K3(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoW_WIN2K3(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoA_VISTA(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoW_VISTA(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoA_WIN2K8(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
BOOL WINAPI VerifyVersionInfoW_WIN2K8(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask, DWORDLONG dwlConditionMask);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
31
apilibs/kexbases/Kernel32/_kernel32_stubs.c
Normal file
31
apilibs/kexbases/Kernel32/_kernel32_stubs.c
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
UNIMPL_FUNC(CreateHardLinkA, 3);
|
||||
UNIMPL_FUNC(CreateHardLinkW, 3);
|
||||
UNIMPL_FUNC(GetConsoleWindow, 0);
|
||||
UNIMPL_FUNC(IsValidLanguageGroup, 2);
|
||||
UNIMPL_FUNC(QueueUserWorkItem, 3);
|
||||
UNIMPL_FUNC(ReplaceFileA, 6);
|
||||
UNIMPL_FUNC(ReplaceFileW, 6);
|
||||
UNIMPL_FUNC(FindFirstFileExW, 6);
|
160
apilibs/kexbases/Kernel32/uilang.c
Normal file
160
apilibs/kexbases/Kernel32/uilang.c
Normal file
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
static DWORD hexstr_to_dword(const char* hexstr)
|
||||
{
|
||||
int i;
|
||||
DWORD res = 0;
|
||||
|
||||
for (i = 0 ; i < 8 ; i++)
|
||||
{
|
||||
res <<= 4;
|
||||
if (hexstr[i] >= '0' && hexstr[i] <= '9')
|
||||
res += hexstr[i] - '0';
|
||||
else if (hexstr[i] >= 'a' && hexstr[i] <= 'f')
|
||||
res += hexstr[i] - 'a' + 0xa;
|
||||
else if (hexstr[i] >= 'A' && hexstr[i] <= 'F')
|
||||
res += hexstr[i] - 'A' + 0xA;
|
||||
else
|
||||
return (DWORD)-1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static void dword_to_hexstr(DWORD val, void* _out, BOOL unicode)
|
||||
{
|
||||
int i;
|
||||
char* out = (char*) _out;
|
||||
|
||||
for (i = 0 ; i < 8 ; i++)
|
||||
{
|
||||
int v = (val & 0xf0000000) >> 28;
|
||||
val <<= 4;
|
||||
if (v <= 9)
|
||||
*out++ = v + '0';
|
||||
else
|
||||
*out++ = v - 0xa + 'A';
|
||||
if (unicode)
|
||||
*out++ = 0;
|
||||
}
|
||||
*out++ = 0;
|
||||
if (unicode)
|
||||
*out++ = 0;
|
||||
}
|
||||
|
||||
static LANGID UILanguage_readreg()
|
||||
{
|
||||
HKEY key;
|
||||
DWORD type;
|
||||
char data[10];
|
||||
LONG res;
|
||||
DWORD count = sizeof(data);
|
||||
|
||||
if (RegOpenKey(HKEY_CURRENT_USER, "Control Panel\\desktop\\ResourceLocale", &key))
|
||||
return (LANGID) -1;
|
||||
|
||||
res = RegQueryValueEx(key, NULL, NULL, &type, (BYTE*)data, &count);
|
||||
RegCloseKey(key);
|
||||
|
||||
if (!res && type == REG_SZ && count == 9)
|
||||
{
|
||||
DWORD res = hexstr_to_dword(data);
|
||||
if (res < 0x10000)
|
||||
return (LANGID) res;
|
||||
}
|
||||
return (LANGID) -1;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetUserDefaultUILanguage_new=GetUserDefaultUILanguage */
|
||||
LANGID WINAPI GetUserDefaultUILanguage_new(void)
|
||||
{
|
||||
LANGID res = UILanguage_readreg();
|
||||
if (res != (LANGID) -1)
|
||||
return res;
|
||||
return (LANGID) 0x409; /* default to English US */
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetSystemDefaultUILanguage_new=GetSystemDefaultUILanguage */
|
||||
LANGID WINAPI GetSystemDefaultUILanguage_new(void)
|
||||
{
|
||||
LANGID res = UILanguage_readreg();
|
||||
if (res != (LANGID) -1)
|
||||
return res;
|
||||
return (LANGID) 0x409; /* default to English US */
|
||||
}
|
||||
|
||||
typedef long LONG_PTR;
|
||||
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCA)(LPSTR, LONG_PTR);
|
||||
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCW)(LPWSTR, LONG_PTR);
|
||||
|
||||
/* MAKE_EXPORT EnumUILanguagesA_new=EnumUILanguagesA */
|
||||
BOOL WINAPI EnumUILanguagesA_new(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
|
||||
{
|
||||
char buf[10];
|
||||
LANGID lid;
|
||||
|
||||
if (!pUILangEnumProc)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (dwFlags)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lid = GetSystemDefaultUILanguage_new();
|
||||
|
||||
dword_to_hexstr(lid, buf, FALSE);
|
||||
|
||||
pUILangEnumProc(buf, lParam);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT EnumUILanguagesW_new=EnumUILanguagesW */
|
||||
BOOL WINAPI EnumUILanguagesW_new(UILANGUAGE_ENUMPROCW pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam)
|
||||
{
|
||||
WCHAR buf[10];
|
||||
LANGID lid;
|
||||
|
||||
if (!pUILangEnumProc)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (dwFlags)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_FLAGS);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lid = GetSystemDefaultUILanguage_new();
|
||||
|
||||
dword_to_hexstr(lid, buf, TRUE);
|
||||
|
||||
pUILangEnumProc(buf, lParam);
|
||||
return TRUE;
|
||||
}
|
794
apilibs/kexbases/Kernel32/unikernel32.c
Normal file
794
apilibs/kexbases/Kernel32/unikernel32.c
Normal file
@ -0,0 +1,794 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2006-2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#define _WIN32_WINDOWS 0x0410
|
||||
#define ENABLE_FILEAPIS
|
||||
#include "common.h"
|
||||
#include <tlhelp32.h>
|
||||
#include "_kernel32_apilist.h"
|
||||
|
||||
//MAKE_EXPORT AddAtomW_new=AddAtomW
|
||||
ATOM WINAPI AddAtomW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return AddAtomA(strA);
|
||||
}
|
||||
|
||||
/* something seems to be wrong with this and I don't know what
|
||||
INT WINAPI CompareStringW_new(LCID lcid, DWORD style,
|
||||
LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
|
||||
{
|
||||
CHAR buf1A[BUFSIZE];
|
||||
CHAR buf2A[BUFSIZE];
|
||||
LPSTR str1A, str2A;
|
||||
INT len1A, len2A, ret;
|
||||
UINT locale_cp = CP_ACP;
|
||||
int lasterr;
|
||||
|
||||
DBGMSGW((L"CompareStringW(0x%1!x!,0x%2!x!,%3!s!,%4!d!,%5!s!,%6!d!)\n",lcid,style,str1,len1,str2,len2));
|
||||
|
||||
lasterr = GetLastError();
|
||||
if (lcid == LANG_INVARIANT) lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT);
|
||||
|
||||
if (!str1 || !str2)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(style & LOCALE_USE_CP_ACP))
|
||||
if (!GetLocaleInfoA(lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER,
|
||||
(CHAR *)&locale_cp, sizeof(locale_cp)/sizeof(CHAR))) locale_cp = 0;
|
||||
|
||||
str1A = buf1A;
|
||||
if (len1 != 0)
|
||||
{
|
||||
len1A = WideCharToMultiByte(locale_cp, 0, str1, len1, buf1A, BUFSIZE, NULL, NULL);
|
||||
if (!len1A)
|
||||
{
|
||||
len1A = WideCharToMultiByte(locale_cp, 0, str1, len1, NULL, 0, NULL, NULL);
|
||||
str1A = HeapAlloc(GetProcessHeap(), 0, len1A);
|
||||
if (!str1A)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return 0;
|
||||
}
|
||||
WideCharToMultiByte(locale_cp, 0, str1, len1, str1A, len1A, NULL, NULL);
|
||||
}
|
||||
}
|
||||
str2A = buf2A;
|
||||
if (len2 != 0)
|
||||
{
|
||||
len2A = WideCharToMultiByte(locale_cp, 0, str2, len2, buf2A, BUFSIZE, NULL, NULL);
|
||||
if (!len2A)
|
||||
{
|
||||
len2A = WideCharToMultiByte(locale_cp, 0, str2, len2, NULL, 0, NULL, NULL);
|
||||
str2A = HeapAlloc(GetProcessHeap(), 0, len2A);
|
||||
if (!str2A)
|
||||
{
|
||||
if (str1A != buf1A) HeapFree(GetProcessHeap(), 0, str1A);
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return 0;
|
||||
}
|
||||
WideCharToMultiByte(locale_cp, 0, str2, len2, str2A, len2A, NULL, NULL);
|
||||
}
|
||||
}
|
||||
SetLastError(lasterr);
|
||||
|
||||
ret = CompareStringA(lcid, style, str1A, len1A, str2A, len2A);
|
||||
|
||||
if (str1A != buf1A) HeapFree(GetProcessHeap(), 0, str1A);
|
||||
if (str2A != buf2A) HeapFree(GetProcessHeap(), 0, str2A);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
//MAKE_EXPORT CopyFileExW_new=CopyFileExW
|
||||
BOOL WINAPI CopyFileExW_new(LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, LPBOOL pbCancel, DWORD dwCopyFlags)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpExistingFileName);
|
||||
file_ALLOC_WtoA(lpNewFileName);
|
||||
return CopyFileExA_new(lpExistingFileNameA, lpNewFileNameA,
|
||||
lpProgressRoutine, lpData, pbCancel, dwCopyFlags);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT CopyFileW_new=CopyFileW
|
||||
BOOL WINAPI CopyFileW_new(LPCWSTR lpExistingFileNameW, LPCWSTR lpNewFileNameW, BOOL bFailIfExists)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpExistingFileName);
|
||||
file_ALLOC_WtoA(lpNewFileName);
|
||||
return CopyFileA(lpExistingFileNameA, lpNewFileNameA, bFailIfExists);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT CreateDirectoryExW_new=CreateDirectoryExW
|
||||
BOOL WINAPI CreateDirectoryExW_new(LPCWSTR templatedirW, LPCWSTR newdirW, LPSECURITY_ATTRIBUTES secattr)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(templatedir);
|
||||
file_ALLOC_WtoA(newdir);
|
||||
return CreateDirectoryExA(templatedirA, newdirA, secattr);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT CreateDirectoryW_new=CreateDirectoryW
|
||||
BOOL WINAPI CreateDirectoryW_new(LPCWSTR PathW, LPSECURITY_ATTRIBUTES SecAttr)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(Path);
|
||||
return CreateDirectoryA(PathA, SecAttr);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT CreateFileW_new=CreateFileW
|
||||
HANDLE WINAPI CreateFileW_new(LPCWSTR strW, DWORD access, DWORD sharemode,
|
||||
LPSECURITY_ATTRIBUTES secattr, DWORD creatdistr, DWORD flags, HANDLE temp)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
return CreateFileA_fix(strA, access, sharemode, secattr, creatdistr, flags, temp);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT DefineDosDeviceW_new=DefineDosDeviceW
|
||||
BOOL WINAPI DefineDosDeviceW_new(DWORD dwFlags, LPCWSTR lpDeviceNameW,
|
||||
LPCWSTR lpTargetPathW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpDeviceName);
|
||||
file_ALLOC_WtoA(lpTargetPath);
|
||||
return DefineDosDeviceA(dwFlags, lpDeviceNameA, lpTargetPathA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT DeleteFileW_new=DeleteFileW
|
||||
BOOL WINAPI DeleteFileW_new(LPCWSTR lpFileNameW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpFileName);
|
||||
return DeleteFileA(lpFileNameA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FindAtomW_new=FindAtomW
|
||||
ATOM WINAPI FindAtomW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return FindAtomA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FindFirstChangeNotificationW_new=FindFirstChangeNotificationW
|
||||
HANDLE WINAPI FindFirstChangeNotificationW_new(LPCWSTR pathW, BOOL watchsubtree, DWORD filter)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(path);
|
||||
return FindFirstChangeNotificationA(pathA, watchsubtree, filter);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FindFirstFileW_new=FindFirstFileW
|
||||
HANDLE WINAPI FindFirstFileW_new(LPCWSTR strW, LPWIN32_FIND_DATAW dataW)
|
||||
{
|
||||
HANDLE ret;
|
||||
char cFileNameA[MAX_PATH];
|
||||
char cAlternateFileNameA[14];
|
||||
WCHAR* cFileNameW = dataW->cFileName;
|
||||
WCHAR* cAlternateFileNameW = dataW->cAlternateFileName;
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(str);
|
||||
ret = FindFirstFileA(strA, (LPWIN32_FIND_DATAA)dataW);
|
||||
if (ret != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
strcpy(cFileNameA, ((LPWIN32_FIND_DATAA)dataW)->cFileName);
|
||||
strcpy(cAlternateFileNameA, ((LPWIN32_FIND_DATAA)dataW)->cAlternateFileName);
|
||||
file_AtoW(cFileName, sizeof(dataW->cFileName) / sizeof(WCHAR));
|
||||
file_AtoW(cAlternateFileName, sizeof(dataW->cAlternateFileName) / sizeof(WCHAR));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FindNextFileW_new=FindNextFileW
|
||||
BOOL WINAPI FindNextFileW_new(HANDLE handle, LPWIN32_FIND_DATAW dataW)
|
||||
{
|
||||
BOOL ret;
|
||||
char cFileNameA[MAX_PATH];
|
||||
char cAlternateFileNameA[14];
|
||||
WCHAR* cFileNameW = dataW->cFileName;
|
||||
WCHAR* cAlternateFileNameW = dataW->cAlternateFileName;
|
||||
ret = FindNextFileA(handle, (LPWIN32_FIND_DATAA)dataW);
|
||||
if (ret)
|
||||
{
|
||||
file_GetCP();
|
||||
strcpy(cFileNameA, ((LPWIN32_FIND_DATAA)dataW)->cFileName);
|
||||
strcpy(cAlternateFileNameA, ((LPWIN32_FIND_DATAA)dataW)->cAlternateFileName);
|
||||
file_AtoW(cFileName, sizeof(dataW->cFileName) / sizeof(WCHAR));
|
||||
file_AtoW(cAlternateFileName, sizeof(dataW->cAlternateFileName) / sizeof(WCHAR));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FindResourceExW_new=FindResourceExW
|
||||
HRSRC WINAPI FindResourceExW_new(HMODULE hModule, LPCWSTR typeW, LPCWSTR nameW, WORD lang)
|
||||
{
|
||||
LPSTR nameA, typeA;
|
||||
|
||||
if (HIWORD(nameW))
|
||||
{
|
||||
_ALLOC_WtoA(name);
|
||||
}
|
||||
else
|
||||
nameA = (LPSTR) nameW;
|
||||
|
||||
if (HIWORD(typeW))
|
||||
{
|
||||
_ALLOC_WtoA(type);
|
||||
}
|
||||
else
|
||||
typeA = (LPSTR) typeW;
|
||||
|
||||
return FindResourceExA(hModule, typeA, nameA, lang);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FindResourceW_new=FindResourceW
|
||||
HRSRC WINAPI FindResourceW_new(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
|
||||
{
|
||||
return FindResourceExW_new(hModule, type, name, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
|
||||
}
|
||||
|
||||
//MAKE_EXPORT FreeEnvironmentStringsW_new=FreeEnvironmentStringsW
|
||||
BOOL WINAPI FreeEnvironmentStringsW_new(void* env)
|
||||
{
|
||||
return HeapFree(GetProcessHeap(), 0, env);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetCurrentDirectoryW_new=GetCurrentDirectoryW
|
||||
DWORD WINAPI GetCurrentDirectoryW_new(DWORD nBufferLength, LPWSTR lpBufferW)
|
||||
{
|
||||
DWORD ret;
|
||||
char lpBufferA[MAX_PATH];
|
||||
ret = GetCurrentDirectoryA(MAX_PATH, lpBufferA);
|
||||
if (ret)
|
||||
{
|
||||
file_GetCP();
|
||||
if (ret > MAX_PATH)
|
||||
{
|
||||
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||
return 0;
|
||||
}
|
||||
ret = file_AtoW(lpBuffer, 0);
|
||||
if (ret <= nBufferLength)
|
||||
{
|
||||
ret = file_AtoW(lpBuffer, nBufferLength);
|
||||
if (ret) ret--;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetDefaultCommConfigW_new=GetDefaultCommConfigW
|
||||
BOOL WINAPI GetDefaultCommConfigW_new(LPCWSTR lpszNameW, LPCOMMCONFIG lpCC, LPDWORD lpdwSize)
|
||||
{
|
||||
ALLOC_WtoA(lpszName);
|
||||
return GetDefaultCommConfigA(lpszNameA, lpCC, lpdwSize);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetDiskFreeSpaceExW_new=GetDiskFreeSpaceExW
|
||||
BOOL WINAPI GetDiskFreeSpaceExW_new(LPCWSTR lpDirectoryNameW, PULARGE_INTEGER lpFreeBytesAvailableToCaller, PULARGE_INTEGER lpTotalNumberOfBytes, PULARGE_INTEGER lpTotalNumberOfFreeBytes)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpDirectoryName);
|
||||
return GetDiskFreeSpaceExA(lpDirectoryNameA, lpFreeBytesAvailableToCaller, lpTotalNumberOfBytes, lpTotalNumberOfFreeBytes);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetDiskFreeSpaceW_new=GetDiskFreeSpaceW
|
||||
BOOL WINAPI GetDiskFreeSpaceW_new(LPCWSTR lpRootPathNameW, LPDWORD lpSectorsPerCluster, LPDWORD lpBytesPerSector, LPDWORD lpNumberOfFreeClusters, LPDWORD lpTotalNumberOfClusters)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpRootPathName);
|
||||
return GetDiskFreeSpaceA(lpRootPathNameA, lpSectorsPerCluster, lpBytesPerSector, lpNumberOfFreeClusters, lpTotalNumberOfClusters);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetEnvironmentStringsW_new=GetEnvironmentStringsW
|
||||
void* WINAPI GetEnvironmentStringsW_new(void)
|
||||
{
|
||||
int len;
|
||||
WCHAR* envW;
|
||||
char* envA = GetEnvironmentStringsA();
|
||||
char* ptrA = (char*) envA;
|
||||
if (!envA) return envA;
|
||||
|
||||
do while (*ptrA++); while (*++ptrA);
|
||||
len = (int) ptrA - (int) envA;
|
||||
|
||||
envW = (WCHAR*) HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
if (envW)
|
||||
ABUFtoW(env, len, len);
|
||||
FreeEnvironmentStringsA(envA);
|
||||
return envW;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetFileAttributesExW_new=GetFileAttributesExW
|
||||
BOOL WINAPI GetFileAttributesExW_new(LPCWSTR lpFileNameW, GET_FILEEX_INFO_LEVELS fInfoLevelId,
|
||||
LPVOID lpFileInformation)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpFileName);
|
||||
return GetFileAttributesExA(lpFileNameA, fInfoLevelId, lpFileInformation);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetFileAttributesW_new=GetFileAttributesW
|
||||
DWORD WINAPI GetFileAttributesW_new(LPCWSTR lpFileNameW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpFileName);
|
||||
return GetFileAttributesA(lpFileNameA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetFullPathNameW_new=GetFullPathNameW
|
||||
DWORD WINAPI GetFullPathNameW_new(LPCWSTR lpFileNameW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW)
|
||||
{
|
||||
DWORD ret;
|
||||
char lpBufferA[MAX_PATH];
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpFileName);
|
||||
ret = GetFullPathNameA(lpFileNameA, MAX_PATH, lpBufferA, NULL);
|
||||
if (ret)
|
||||
{
|
||||
if (ret > MAX_PATH)
|
||||
{
|
||||
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||
return 0;
|
||||
}
|
||||
ret = file_AtoW(lpBuffer, 0);
|
||||
if (ret <= nBufferLength)
|
||||
{
|
||||
ret = file_AtoW(lpBuffer, nBufferLength);
|
||||
if (ret && lpFilePartW)
|
||||
{
|
||||
if (lpBufferW[ret - 1] == '\\') *lpFilePartW = 0;
|
||||
else
|
||||
{
|
||||
LPWSTR p = lpBufferW + ret - 1;
|
||||
while ((p > lpBufferW + 2) && (*p != '\\')) p--;
|
||||
*lpFilePartW = p + 1;
|
||||
}
|
||||
}
|
||||
if (ret) ret--;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetLongPathNameW_new=GetLongPathNameW
|
||||
DWORD WINAPI GetLongPathNameW_new(LPCWSTR lpszShortPathW, LPWSTR lpszLongPathW, DWORD cchBuffer)
|
||||
{
|
||||
DWORD ret;
|
||||
char lpszLongPathA[MAX_PATH];
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpszShortPath);
|
||||
ret = GetLongPathNameA(lpszShortPathA, lpszLongPathA, MAX_PATH);
|
||||
if (ret)
|
||||
{
|
||||
if (ret > MAX_PATH)
|
||||
{
|
||||
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||
return 0;
|
||||
}
|
||||
ret = file_AtoW(lpszLongPath, 0);
|
||||
if (ret <= cchBuffer)
|
||||
{
|
||||
ret = file_AtoW(lpszLongPath, cchBuffer);
|
||||
if (ret) ret--;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetShortPathNameW_new=GetShortPathNameW
|
||||
DWORD WINAPI GetShortPathNameW_new(LPCWSTR lpszLongPathW, LPWSTR lpszShortPathW, DWORD cchBuffer)
|
||||
{
|
||||
DWORD ret;
|
||||
char lpszShortPathA[MAX_PATH];
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpszLongPath);
|
||||
ret = GetShortPathNameA(lpszLongPathA, lpszShortPathA, MAX_PATH);
|
||||
if (ret)
|
||||
{
|
||||
if (ret > MAX_PATH)
|
||||
{
|
||||
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||
return 0;
|
||||
}
|
||||
ret = file_AtoW(lpszShortPath, 0);
|
||||
if (ret <= cchBuffer)
|
||||
{
|
||||
ret = file_AtoW(lpszShortPath, cchBuffer);
|
||||
if (ret) ret--;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetStartupInfoW_new=GetStartupInfoW
|
||||
VOID WINAPI GetStartupInfoW_new(LPSTARTUPINFOW lpStartupInfo)
|
||||
{
|
||||
// since lpDesktop and lpTitle and lpReserved are
|
||||
// always zero we can just execute ansi version
|
||||
GetStartupInfoA((LPSTARTUPINFOA)lpStartupInfo);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetSystemDirectoryW_new=GetSystemDirectoryW
|
||||
UINT WINAPI GetSystemDirectoryW_new(LPWSTR lpBufferW, UINT uSize)
|
||||
{
|
||||
UINT ret;
|
||||
char lpBufferA[MAX_PATH];
|
||||
ret = GetSystemDirectoryA(lpBufferA, MAX_PATH);
|
||||
if (ret)
|
||||
{
|
||||
if (ret > MAX_PATH)
|
||||
{
|
||||
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||
return 0;
|
||||
}
|
||||
file_GetCP();
|
||||
ret = file_AtoW(lpBuffer, 0);
|
||||
if (ret <= uSize)
|
||||
{
|
||||
ret = file_AtoW(lpBuffer, uSize);
|
||||
if (ret) ret--;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetTempFileNameW_new=GetTempFileNameW
|
||||
UINT WINAPI GetTempFileNameW_new(LPCWSTR lpPathNameW, LPCWSTR lpPrefixStringW, UINT uUnique, LPWSTR lpTempFileNameW)
|
||||
{
|
||||
UINT ret;
|
||||
char lpTempFileNameA[MAX_PATH];
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpPathName);
|
||||
file_ALLOC_WtoA(lpPrefixString);
|
||||
ret = GetTempFileNameA(lpPathNameA, lpPrefixStringA, uUnique, lpTempFileNameA);
|
||||
if (ret)
|
||||
{
|
||||
file_AtoW(lpTempFileName, MAX_PATH);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetTempPathW_new=GetTempPathW
|
||||
DWORD WINAPI GetTempPathW_new(DWORD nBufferLength, LPWSTR lpBufferW)
|
||||
{
|
||||
DWORD ret;
|
||||
char lpBufferA[MAX_PATH];
|
||||
ret = GetTempPathA(MAX_PATH, lpBufferA);
|
||||
if (ret)
|
||||
{
|
||||
if (ret > MAX_PATH)
|
||||
{
|
||||
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||
return 0;
|
||||
}
|
||||
file_GetCP();
|
||||
ret = file_AtoW(lpBuffer, 0);
|
||||
if (ret <= nBufferLength)
|
||||
{
|
||||
ret = file_AtoW(lpBuffer, nBufferLength);
|
||||
if (ret) ret--;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GetWindowsDirectoryW_new=GetWindowsDirectoryW
|
||||
UINT WINAPI GetWindowsDirectoryW_new(LPWSTR lpBufferW, UINT uSize)
|
||||
{
|
||||
UINT ret;
|
||||
char lpBufferA[MAX_PATH];
|
||||
ret = GetWindowsDirectoryA(lpBufferA, MAX_PATH);
|
||||
if (ret)
|
||||
{
|
||||
if (ret > MAX_PATH)
|
||||
{
|
||||
SetLastError(ERROR_FILENAME_EXCED_RANGE);
|
||||
return 0;
|
||||
}
|
||||
file_GetCP();
|
||||
ret = file_AtoW(lpBuffer, 0);
|
||||
if (ret <= uSize)
|
||||
{
|
||||
ret = file_AtoW(lpBuffer, uSize);
|
||||
if (ret) ret--;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GlobalAddAtomW_new=GlobalAddAtomW
|
||||
ATOM WINAPI GlobalAddAtomW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return GlobalAddAtomA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GlobalFindAtomW_new=GlobalFindAtomW
|
||||
ATOM WINAPI GlobalFindAtomW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return GlobalFindAtomA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT GlobalGetAtomNameW_new=GlobalGetAtomNameW
|
||||
UINT WINAPI GlobalGetAtomNameW_new(ATOM atom, LPWSTR bufferW, int size)
|
||||
{
|
||||
UINT ret;
|
||||
ALLOC_A(buffer, size * acp_mcs);
|
||||
ret = GlobalGetAtomNameA(atom, bufferA, size * acp_mcs);
|
||||
if (ret)
|
||||
ret = ABUFtoW(buffer, ret + 1, size);
|
||||
if (ret) ret--;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT Module32FirstW_new=Module32FirstW
|
||||
BOOL WINAPI Module32FirstW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW)
|
||||
{
|
||||
BOOL ret;
|
||||
char szModuleA[MAX_MODULE_NAME32 + 1];
|
||||
char szExePathA[MAX_PATH];
|
||||
WCHAR* szModuleW = lpmeW->szModule;
|
||||
WCHAR* szExePathW = lpmeW->szExePath;
|
||||
|
||||
if (lpmeW->dwSize < sizeof(MODULEENTRY32W))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32);
|
||||
|
||||
if ((ret = Module32First(hSnapshot, (LPMODULEENTRY32)lpmeW)) != FALSE)
|
||||
{
|
||||
strcpy(szModuleA, ((LPMODULEENTRY32)lpmeW)->szModule);
|
||||
strcpy(szExePathA, ((LPMODULEENTRY32)lpmeW)->szExePath);
|
||||
AtoW(szModule, sizeof(lpmeW->szModule) / sizeof(WCHAR));
|
||||
AtoW(szExePath, sizeof(lpmeW->szExePath) / sizeof(WCHAR));
|
||||
}
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32W);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT Module32NextW_new=Module32NextW
|
||||
BOOL WINAPI Module32NextW_new(HANDLE hSnapshot, LPMODULEENTRY32W lpmeW)
|
||||
{
|
||||
BOOL ret;
|
||||
char szModuleA[MAX_MODULE_NAME32 + 1];
|
||||
char szExePathA[MAX_PATH];
|
||||
WCHAR* szModuleW = lpmeW->szModule;
|
||||
WCHAR* szExePathW = lpmeW->szExePath;
|
||||
|
||||
if (lpmeW->dwSize < sizeof(MODULEENTRY32W))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_DATA);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32);
|
||||
|
||||
if ((ret = Module32Next(hSnapshot, (LPMODULEENTRY32)lpmeW)) != FALSE)
|
||||
{
|
||||
strcpy(szModuleA, ((LPMODULEENTRY32)lpmeW)->szModule);
|
||||
strcpy(szExePathA, ((LPMODULEENTRY32)lpmeW)->szExePath);
|
||||
AtoW(szModule, sizeof(lpmeW->szModule) / sizeof(WCHAR));
|
||||
AtoW(szExePath, sizeof(lpmeW->szExePath) / sizeof(WCHAR));
|
||||
}
|
||||
lpmeW->dwSize = sizeof(MODULEENTRY32W);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT MoveFileExW_new=MoveFileExW
|
||||
BOOL WINAPI MoveFileExW_new(LPCWSTR existingfileW, LPCWSTR newfileW, DWORD flags)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(existingfile);
|
||||
file_ALLOC_WtoA(newfile);
|
||||
return MoveFileExA_new(existingfileA, newfileA, flags);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT MoveFileW_new=MoveFileW
|
||||
BOOL WINAPI MoveFileW_new(LPCWSTR existingfileW, LPCWSTR newfileW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(existingfile);
|
||||
file_ALLOC_WtoA(newfile);
|
||||
return MoveFileA(existingfileA, newfileA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT MoveFileWithProgressW_new=MoveFileWithProgressW
|
||||
BOOL WINAPI MoveFileWithProgressW_new(LPCWSTR existingfileW, LPCWSTR newfileW, LPPROGRESS_ROUTINE lpProgressRoutine, LPVOID lpData, DWORD dwFlags)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(existingfile);
|
||||
file_ALLOC_WtoA(newfile);
|
||||
return MoveFileWithProgressA_new(existingfileA, newfileA, lpProgressRoutine, lpData, dwFlags);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT OutputDebugStringW_new=OutputDebugStringW
|
||||
void WINAPI OutputDebugStringW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
OutputDebugStringA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT Process32FirstW_new=Process32FirstW
|
||||
BOOL WINAPI Process32FirstW_new(HANDLE hSnapshot, LPPROCESSENTRY32W lppeW)
|
||||
{
|
||||
BOOL ret;
|
||||
char szExeFileA[MAX_PATH];
|
||||
WCHAR* szExeFileW = lppeW->szExeFile;
|
||||
|
||||
if (lppeW->dwSize < sizeof(PROCESSENTRY32W))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lppeW->dwSize = sizeof(PROCESSENTRY32);
|
||||
|
||||
if ((ret = Process32First(hSnapshot, (LPPROCESSENTRY32)lppeW)) != FALSE)
|
||||
{
|
||||
strcpy(szExeFileA, ((LPPROCESSENTRY32)lppeW)->szExeFile);
|
||||
AtoW(szExeFile, sizeof(lppeW->szExeFile) / sizeof(WCHAR));
|
||||
}
|
||||
lppeW->dwSize = sizeof(PROCESSENTRY32W);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT Process32NextW_new=Process32NextW
|
||||
BOOL WINAPI Process32NextW_new(HANDLE hSnapshot, LPPROCESSENTRY32W lppeW)
|
||||
{
|
||||
BOOL ret;
|
||||
char szExeFileA[MAX_PATH];
|
||||
WCHAR* szExeFileW = lppeW->szExeFile;
|
||||
|
||||
if (lppeW->dwSize < sizeof(PROCESSENTRY32W))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_DATA);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
lppeW->dwSize = sizeof(PROCESSENTRY32);
|
||||
|
||||
if ((ret = Process32Next(hSnapshot, (LPPROCESSENTRY32)lppeW)) != FALSE)
|
||||
{
|
||||
strcpy(szExeFileA, ((LPPROCESSENTRY32)lppeW)->szExeFile);
|
||||
AtoW(szExeFile, sizeof(lppeW->szExeFile) / sizeof(WCHAR));
|
||||
}
|
||||
lppeW->dwSize = sizeof(PROCESSENTRY32W);
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT RemoveDirectoryW_new=RemoveDirectoryW
|
||||
BOOL WINAPI RemoveDirectoryW_new(LPCWSTR lpPathNameW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpPathName);
|
||||
return RemoveDirectoryA(lpPathNameA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT SearchPathW_new=SearchPathW
|
||||
DWORD WINAPI SearchPathW_new(LPCWSTR lpPathW, LPCWSTR lpFileNameW, LPCWSTR lpExtensionW, DWORD nBufferLength, LPWSTR lpBufferW, LPWSTR *lpFilePartW)
|
||||
{
|
||||
DWORD ret;
|
||||
char lpBufferA[MAX_PATH];
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpPath);
|
||||
file_ALLOC_WtoA(lpFileName);
|
||||
file_ALLOC_WtoA(lpExtension);
|
||||
ret = SearchPathA(lpPathA, lpFileNameA, lpExtensionA, MAX_PATH, lpBufferA, NULL);
|
||||
if (ret)
|
||||
{
|
||||
ret = file_AtoW(lpBuffer, 0);
|
||||
if (ret <= nBufferLength)
|
||||
{
|
||||
ret = file_AtoW(lpBuffer, nBufferLength);
|
||||
if (lpFilePartW)
|
||||
{
|
||||
DWORD i;
|
||||
for (i = ret ; i >= 0 ; i--)
|
||||
{
|
||||
if (lpBufferW[i] == '\\')
|
||||
{
|
||||
*lpFilePartW = &lpBufferW[i + 1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT SetConsoleTitleW_new=SetConsoleTitleW
|
||||
BOOL WINAPI SetConsoleTitleW_new(LPCWSTR strW)
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return SetConsoleTitleA(strA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT SetCurrentDirectoryW_new=SetCurrentDirectoryW
|
||||
BOOL WINAPI SetCurrentDirectoryW_new(LPCWSTR lpPathNameW)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpPathName);
|
||||
return SetCurrentDirectoryA(lpPathNameA);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT SetFileAttributesW_new=SetFileAttributesW
|
||||
BOOL WINAPI SetFileAttributesW_new(LPCWSTR lpFileNameW, DWORD dwFileAttributes)
|
||||
{
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(lpFileName);
|
||||
return SetFileAttributesA(lpFileNameA, dwFileAttributes);
|
||||
}
|
||||
|
||||
//MAKE_EXPORT VerLanguageNameW_new=VerLanguageNameW
|
||||
DWORD WINAPI VerLanguageNameW_new(DWORD wLang, LPWSTR szLangW, DWORD nSize)
|
||||
{
|
||||
DWORD ret;
|
||||
DWORD buf_size = VerLanguageNameA(wLang, NULL, 1); //GPF if nSize==0
|
||||
|
||||
if (!buf_size) return 0;
|
||||
buf_size++;
|
||||
|
||||
ALLOC_A(szLang, buf_size);
|
||||
|
||||
ret = VerLanguageNameA(wLang, szLangA, buf_size);
|
||||
if (ret)
|
||||
{
|
||||
DWORD last_err = GetLastError();
|
||||
ret = AtoW(szLang, nSize);
|
||||
if (!ret)
|
||||
{
|
||||
szLangW[nSize - 1] = 0;
|
||||
ret = AtoW(szLang, 0);
|
||||
}
|
||||
if (ret) ret--;
|
||||
SetLastError(last_err);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//MAKE_EXPORT lstrcpynW_new=lstrcpynW
|
||||
LPWSTR WINAPI lstrcpynW_new(LPWSTR dst, LPCWSTR src, INT n)
|
||||
{
|
||||
LPWSTR ret = dst;
|
||||
|
||||
if (IsBadReadPtr(src, n) || IsBadWritePtr(dst, n))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((n > 1) && *src)
|
||||
{
|
||||
*dst++ = *src++;
|
||||
n--;
|
||||
}
|
||||
*dst = 0;
|
||||
return ret;
|
||||
}
|
584
apilibs/kexbases/Kernel32/version.c
Normal file
584
apilibs/kexbases/Kernel32/version.c
Normal file
@ -0,0 +1,584 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "auxdecl.h"
|
||||
|
||||
/* special structure used internally to save some space */
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwMinorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformId;
|
||||
CHAR* lpszCSDVersion;
|
||||
WORD wServicePackMajor;
|
||||
WORD wServicePackMinor;
|
||||
WORD wSuiteMask;
|
||||
BYTE wProductType;
|
||||
BYTE wReserved;
|
||||
} OSVERSIONINFOEXA_PRIV;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WIN95, /* Windows 95 */
|
||||
WIN98, /* Windows 98 */
|
||||
WINME, /* Windows Me */
|
||||
NT40, /* Windows NT 4.0 */
|
||||
NT2K, /* Windows 2000 */
|
||||
WINXP, /* Windows XP */
|
||||
WIN2K3, /* Windows 2003 */
|
||||
VISTA, /* Windows Vista */
|
||||
WIN2K8, /* Windows 2008 */
|
||||
NB_WINDOWS_VERSIONS
|
||||
} WINDOWS_VERSION;
|
||||
|
||||
static const OSVERSIONINFOEXA_PRIV VersionData[NB_WINDOWS_VERSIONS] =
|
||||
{
|
||||
/* WIN95 */
|
||||
{
|
||||
4, 0, 0x40003B6, VER_PLATFORM_WIN32_WINDOWS,
|
||||
"",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* WIN98 (second edition) */
|
||||
{
|
||||
4, 10, 0x40A08AE, VER_PLATFORM_WIN32_WINDOWS,
|
||||
" A ",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* WINME */
|
||||
{
|
||||
4, 90, 0x45A0BB8, VER_PLATFORM_WIN32_WINDOWS,
|
||||
" ",
|
||||
0, 0, 0, 0, 0
|
||||
},
|
||||
/* NT40 */
|
||||
{
|
||||
4, 0, 0x565, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 6a",
|
||||
6, 0, 0, VER_NT_WORKSTATION, 0
|
||||
},
|
||||
/* NT2K */
|
||||
{
|
||||
5, 0, 0x893, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 4",
|
||||
4, 0, 0, VER_NT_WORKSTATION, 30
|
||||
},
|
||||
/* WINXP */
|
||||
{
|
||||
5, 1, 0xA28, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 2",
|
||||
2, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 30
|
||||
},
|
||||
/* WIN2K3 */
|
||||
{
|
||||
5, 2, 0xECE, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 1",
|
||||
1, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
||||
},
|
||||
/* WINVISTA */
|
||||
{
|
||||
6, 0, 0x1770, VER_PLATFORM_WIN32_NT,
|
||||
" ",
|
||||
0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_WORKSTATION, 0
|
||||
},
|
||||
/* WIN2K8 */
|
||||
{
|
||||
6, 0, 0x1771, VER_PLATFORM_WIN32_NT,
|
||||
"Service Pack 1",
|
||||
0, 0, VER_SUITE_SINGLEUSERTS, VER_NT_SERVER, 0
|
||||
}
|
||||
};
|
||||
|
||||
static DWORD common_GetVersion(WINDOWS_VERSION version)
|
||||
{
|
||||
const OSVERSIONINFOEXA_PRIV* osv = &VersionData[version];
|
||||
DWORD result;
|
||||
|
||||
result = MAKELONG(MAKEWORD(osv->dwMajorVersion, osv->dwMinorVersion),
|
||||
(osv->dwPlatformId ^ 2) << 14);
|
||||
if (osv->dwPlatformId == VER_PLATFORM_WIN32_NT)
|
||||
result |= LOWORD(osv->dwBuildNumber) << 16;
|
||||
return result;
|
||||
}
|
||||
|
||||
static BOOL common_GetVersionEx(WINDOWS_VERSION version, void* buf, BOOL unicode)
|
||||
{
|
||||
const OSVERSIONINFOEXA_PRIV* osv = &VersionData[version];
|
||||
|
||||
if (!unicode)
|
||||
{
|
||||
OSVERSIONINFOEXA* osa = (OSVERSIONINFOEXA*) buf;
|
||||
if (osa->dwOSVersionInfoSize != sizeof(OSVERSIONINFOA)
|
||||
&& osa->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXA))
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
osa->dwMajorVersion = osv->dwMajorVersion;
|
||||
osa->dwMinorVersion = osv->dwMinorVersion;
|
||||
osa->dwBuildNumber = osv->dwBuildNumber;
|
||||
osa->dwPlatformId = osv->dwPlatformId;
|
||||
strcpy(osa->szCSDVersion, osv->lpszCSDVersion);
|
||||
if (osa->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA))
|
||||
{
|
||||
osa->wServicePackMajor = osv->wServicePackMajor;
|
||||
osa->wServicePackMinor = osv->wServicePackMinor;
|
||||
osa->wSuiteMask = osv->wSuiteMask;
|
||||
osa->wProductType = osv->wProductType;
|
||||
osa->wReserved = osv->wReserved;
|
||||
}
|
||||
}
|
||||
else //if (unicode)
|
||||
{
|
||||
OSVERSIONINFOEXW* osw = (OSVERSIONINFOEXW*) buf;
|
||||
if (osw->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW)
|
||||
&& osw->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW))
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
osw->dwMajorVersion = osv->dwMajorVersion;
|
||||
osw->dwMinorVersion = osv->dwMinorVersion;
|
||||
osw->dwBuildNumber = osv->dwBuildNumber;
|
||||
osw->dwPlatformId = osv->dwPlatformId;
|
||||
MultiByteToWideChar(CP_ACP, 0, osv->lpszCSDVersion, -1,
|
||||
osw->szCSDVersion, sizeof(osw->szCSDVersion) / sizeof(WCHAR));
|
||||
if (osw->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW))
|
||||
{
|
||||
osw->wServicePackMajor = osv->wServicePackMajor;
|
||||
osw->wServicePackMinor = osv->wServicePackMinor;
|
||||
osw->wSuiteMask = osv->wSuiteMask;
|
||||
osw->wProductType = osv->wProductType;
|
||||
osw->wReserved = osv->wReserved;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static DWORD version_compare_values(ULONG left, ULONG right, UCHAR condition)
|
||||
{
|
||||
switch (condition) {
|
||||
case VER_EQUAL:
|
||||
if (left != right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_GREATER:
|
||||
if (left <= right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_GREATER_EQUAL:
|
||||
if (left < right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_LESS:
|
||||
if (left >= right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_LESS_EQUAL:
|
||||
if (left > right) return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
default:
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
}
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static DWORD common_VerifyVersionInfo(WINDOWS_VERSION version,
|
||||
const OSVERSIONINFOEXA* info, DWORD dwTypeMask, DWORDLONG dwlConditionMask)
|
||||
{
|
||||
const OSVERSIONINFOEXA_PRIV* osv = &VersionData[version];
|
||||
DWORD status;
|
||||
|
||||
if (!(dwTypeMask && dwlConditionMask)) return ERROR_BAD_ARGUMENTS;
|
||||
|
||||
if (dwTypeMask & VER_PRODUCT_TYPE)
|
||||
{
|
||||
status = version_compare_values(osv->wProductType, info->wProductType, (UCHAR)(dwlConditionMask >> 7*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
if (dwTypeMask & VER_SUITENAME)
|
||||
switch(dwlConditionMask >> 6*3 & 0x07)
|
||||
{
|
||||
case VER_AND:
|
||||
if ((info->wSuiteMask & osv->wSuiteMask) != info->wSuiteMask)
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
case VER_OR:
|
||||
if (!(info->wSuiteMask & osv->wSuiteMask) && info->wSuiteMask)
|
||||
return ERROR_OLD_WIN_VERSION;
|
||||
break;
|
||||
default:
|
||||
return ERROR_BAD_ARGUMENTS;
|
||||
}
|
||||
if (dwTypeMask & VER_PLATFORMID)
|
||||
{
|
||||
status = version_compare_values(osv->dwPlatformId, info->dwPlatformId, (UCHAR)(dwlConditionMask >> 3*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
if (dwTypeMask & VER_BUILDNUMBER)
|
||||
{
|
||||
status = version_compare_values(osv->dwBuildNumber, info->dwBuildNumber, (UCHAR)(dwlConditionMask >> 2*3 & 0x07));
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
|
||||
if (dwTypeMask & (VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR|VER_SERVICEPACKMINOR))
|
||||
{
|
||||
UCHAR condition = 0;
|
||||
BOOL do_next_check = TRUE;
|
||||
|
||||
if (dwTypeMask & VER_MAJORVERSION)
|
||||
condition = (UCHAR)(dwlConditionMask >> 1*3 & 0x07);
|
||||
else if (dwTypeMask & VER_MINORVERSION)
|
||||
condition = (UCHAR)(dwlConditionMask >> 0*3 & 0x07);
|
||||
else if (dwTypeMask & VER_SERVICEPACKMAJOR)
|
||||
condition = (UCHAR)(dwlConditionMask >> 5*3 & 0x07);
|
||||
else if (dwTypeMask & VER_SERVICEPACKMINOR)
|
||||
condition = (UCHAR)(dwlConditionMask >> 4*3 & 0x07);
|
||||
|
||||
if (dwTypeMask & VER_MAJORVERSION)
|
||||
{
|
||||
status = version_compare_values(osv->dwMajorVersion, info->dwMajorVersion, condition);
|
||||
do_next_check = (osv->dwMajorVersion == info->dwMajorVersion) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_MINORVERSION) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->dwMinorVersion, info->dwMinorVersion, condition);
|
||||
do_next_check = (osv->dwMinorVersion == info->dwMinorVersion) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_SERVICEPACKMAJOR) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->wServicePackMajor, info->wServicePackMajor, condition);
|
||||
do_next_check = (osv->wServicePackMajor == info->wServicePackMajor) &&
|
||||
((condition != VER_EQUAL) || (status == ERROR_SUCCESS));
|
||||
}
|
||||
if ((dwTypeMask & VER_SERVICEPACKMINOR) && do_next_check)
|
||||
{
|
||||
status = version_compare_values(osv->wServicePackMinor, info->wServicePackMinor, condition);
|
||||
}
|
||||
|
||||
if (status != ERROR_SUCCESS)
|
||||
return status;
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static BOOL WINAPI common_VerifyVersionInfoA(WINDOWS_VERSION version,
|
||||
LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
DWORD ret = common_VerifyVersionInfo(version, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
if (ret)
|
||||
{
|
||||
SetLastError(ret);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL WINAPI common_VerifyVersionInfoW(WINDOWS_VERSION version,
|
||||
LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
DWORD ret;
|
||||
OSVERSIONINFOEXA VersionInfoA;
|
||||
VersionInfoA.dwMajorVersion = lpVersionInfo->dwMajorVersion;
|
||||
VersionInfoA.dwMinorVersion = lpVersionInfo->dwMinorVersion;
|
||||
VersionInfoA.dwBuildNumber = lpVersionInfo->dwBuildNumber;
|
||||
VersionInfoA.dwPlatformId = lpVersionInfo->dwPlatformId;
|
||||
VersionInfoA.wServicePackMajor = lpVersionInfo->wServicePackMajor;
|
||||
VersionInfoA.wServicePackMinor = lpVersionInfo->wServicePackMinor;
|
||||
VersionInfoA.wSuiteMask = lpVersionInfo->wSuiteMask;
|
||||
VersionInfoA.wProductType = lpVersionInfo->wProductType;
|
||||
|
||||
ret = common_VerifyVersionInfo(version, &VersionInfoA, dwTypeMask, dwlConditionMask);
|
||||
if (ret)
|
||||
{
|
||||
SetLastError(ret);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerSetConditionMask_new=VerSetConditionMask */
|
||||
ULONGLONG WINAPI VerSetConditionMask_new(ULONGLONG dwlConditionMask,
|
||||
DWORD dwTypeBitMask, BYTE dwConditionMask)
|
||||
{
|
||||
if (dwTypeBitMask == 0)
|
||||
return dwlConditionMask;
|
||||
dwConditionMask &= 0x07;
|
||||
if (dwConditionMask == 0)
|
||||
return dwlConditionMask;
|
||||
|
||||
if (dwTypeBitMask & VER_PRODUCT_TYPE)
|
||||
dwlConditionMask |= dwConditionMask << 7*3;
|
||||
else if (dwTypeBitMask & VER_SUITENAME)
|
||||
dwlConditionMask |= dwConditionMask << 6*3;
|
||||
else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
||||
dwlConditionMask |= dwConditionMask << 5*3;
|
||||
else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
|
||||
dwlConditionMask |= dwConditionMask << 4*3;
|
||||
else if (dwTypeBitMask & VER_PLATFORMID)
|
||||
dwlConditionMask |= dwConditionMask << 3*3;
|
||||
else if (dwTypeBitMask & VER_BUILDNUMBER)
|
||||
dwlConditionMask |= dwConditionMask << 2*3;
|
||||
else if (dwTypeBitMask & VER_MAJORVERSION)
|
||||
dwlConditionMask |= dwConditionMask << 1*3;
|
||||
else if (dwTypeBitMask & VER_MINORVERSION)
|
||||
dwlConditionMask |= dwConditionMask << 0*3;
|
||||
return dwlConditionMask;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_WIN95=GetVersion */
|
||||
DWORD WINAPI GetVersion_WIN95(void)
|
||||
{
|
||||
return common_GetVersion(WIN95);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_WIN98=GetVersion */
|
||||
DWORD WINAPI GetVersion_WIN98(void)
|
||||
{
|
||||
return common_GetVersion(WIN98);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_WINME=GetVersion */
|
||||
DWORD WINAPI GetVersion_WINME(void)
|
||||
{
|
||||
return common_GetVersion(WINME);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_NT40=GetVersion */
|
||||
DWORD WINAPI GetVersion_NT40(void)
|
||||
{
|
||||
return common_GetVersion(NT40);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_NT2K=GetVersion */
|
||||
DWORD WINAPI GetVersion_NT2K(void)
|
||||
{
|
||||
return common_GetVersion(NT2K);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_WINXP=GetVersion */
|
||||
DWORD WINAPI GetVersion_WINXP(void)
|
||||
{
|
||||
return common_GetVersion(WINXP);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_WIN2K3=GetVersion */
|
||||
DWORD WINAPI GetVersion_WIN2K3(void)
|
||||
{
|
||||
return common_GetVersion(WIN2K3);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_VISTA=GetVersion */
|
||||
DWORD WINAPI GetVersion_VISTA(void)
|
||||
{
|
||||
return common_GetVersion(VISTA);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersion_WIN2K8=GetVersion */
|
||||
DWORD WINAPI GetVersion_WIN2K8(void)
|
||||
{
|
||||
return common_GetVersion(WIN2K8);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_WIN95=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_WIN95(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WIN95, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_WIN95=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_WIN95(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WIN95, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_WIN98=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_WIN98(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WIN98, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_WIN98=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_WIN98(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WIN98, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_WINME=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_WINME(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WINME, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_WINME=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_WINME(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WINME, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_NT40=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_NT40(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(NT40, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_NT40=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_NT40(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(NT40, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_NT2K=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_NT2K(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(NT2K, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_NT2K=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_NT2K(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(NT2K, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_WINXP=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_WINXP(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WINXP, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_WINXP=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_WINXP(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WINXP, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_WIN2K3=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_WIN2K3(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WIN2K3, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_WIN2K3=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_WIN2K3(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WIN2K3, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_VISTA=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_VISTA(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(VISTA, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_VISTA=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_VISTA(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(VISTA, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExA_WIN2K8=GetVersionExA */
|
||||
BOOL WINAPI GetVersionExA_WIN2K8(LPOSVERSIONINFOA lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WIN2K8, lpVersionInfo, FALSE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetVersionExW_WIN2K8=GetVersionExW */
|
||||
BOOL WINAPI GetVersionExW_WIN2K8(LPOSVERSIONINFOW lpVersionInfo)
|
||||
{
|
||||
return common_GetVersionEx(WIN2K8, lpVersionInfo, TRUE);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoA_NT2K=VerifyVersionInfoA */
|
||||
BOOL WINAPI VerifyVersionInfoA_NT2K(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoA(NT2K, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoW_NT2K=VerifyVersionInfoW */
|
||||
BOOL WINAPI VerifyVersionInfoW_NT2K(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoW(NT2K, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoA_WINXP=VerifyVersionInfoA */
|
||||
BOOL WINAPI VerifyVersionInfoA_WINXP(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoA(WINXP, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoW_WINXP=VerifyVersionInfoW */
|
||||
BOOL WINAPI VerifyVersionInfoW_WINXP(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoW(WINXP, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoA_WIN2K3=VerifyVersionInfoA */
|
||||
BOOL WINAPI VerifyVersionInfoA_WIN2K3(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoA(WIN2K3, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoW_WIN2K3=VerifyVersionInfoW */
|
||||
BOOL WINAPI VerifyVersionInfoW_WIN2K3(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoW(WIN2K3, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoA_VISTA=VerifyVersionInfoA */
|
||||
BOOL WINAPI VerifyVersionInfoA_VISTA(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoA(VISTA, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoW_VISTA=VerifyVersionInfoW */
|
||||
BOOL WINAPI VerifyVersionInfoW_VISTA(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoW(VISTA, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoA_WIN2K8=VerifyVersionInfoA */
|
||||
BOOL WINAPI VerifyVersionInfoA_WIN2K8(LPOSVERSIONINFOEXA lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoA(WIN2K8, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerifyVersionInfoW_WIN2K8=VerifyVersionInfoW */
|
||||
BOOL WINAPI VerifyVersionInfoW_WIN2K8(LPOSVERSIONINFOEXW lpVersionInfo, DWORD dwTypeMask,
|
||||
DWORDLONG dwlConditionMask)
|
||||
{
|
||||
return common_VerifyVersionInfoW(WIN2K8, lpVersionInfo, dwTypeMask, dwlConditionMask);
|
||||
}
|
||||
|
50
apilibs/kexbases/User32/CallWindowProcA_fix.c
Normal file
50
apilibs/kexbases/User32/CallWindowProcA_fix.c
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
* Copyright (C) 2008, Tihiy
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
__declspec(naked)
|
||||
/* MAKE_EXPORT CallWindowProcA_fix=CallWindowProcA */
|
||||
LRESULT WINAPI CallWindowProcA_fix(WNDPROC lpPrevWndFunc, HWND hWnd,
|
||||
UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static const char unicows_str[] = "unicows.dll";
|
||||
static const char callwindowproca_str[] = "CallWindowProcA";
|
||||
|
||||
/* We shouldn't write it in C because some weird programs depend
|
||||
* on CallWindowProc calling function directly!
|
||||
*/
|
||||
__asm {
|
||||
mov eax, [esp+4] ;lpPrevWndFunc
|
||||
and eax, 0x7FFFFFF0
|
||||
cmp eax, 0x7FFFFFF0
|
||||
je UNI
|
||||
jmp dword ptr [CallWindowProcA]
|
||||
UNI:
|
||||
push offset unicows_str
|
||||
call dword ptr [GetModuleHandleA]
|
||||
push offset callwindowproca_str
|
||||
push eax
|
||||
call dword ptr [GetProcAddress]
|
||||
jmp eax
|
||||
}
|
||||
}
|
25
apilibs/kexbases/User32/DisableProcessWindowsGhosting.c
Normal file
25
apilibs/kexbases/User32/DisableProcessWindowsGhosting.c
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
/* MAKE_EXPORT DisableProcessWindowsGhosting_new=DisableProcessWindowsGhosting */
|
||||
void __stdcall DisableProcessWindowsGhosting_new(void)
|
||||
{
|
||||
}
|
36
apilibs/kexbases/User32/EnableWindow.c
Normal file
36
apilibs/kexbases/User32/EnableWindow.c
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/*
|
||||
* Win9x seems to look at only the low 16 bits of bEnable.
|
||||
* This causes a problem, for example, if the caller passes
|
||||
* a count of items with the intent to enable a window when
|
||||
* the count is >0. That will fail when the count is
|
||||
* a multiple of 64K
|
||||
*/
|
||||
|
||||
/* MAKE_EXPORT EnableWindow_new=EnableWindow */
|
||||
BOOL WINAPI EnableWindow_new(HWND hWnd, BOOL bEnable)
|
||||
{
|
||||
return EnableWindow(hWnd, bEnable ? TRUE : FALSE);
|
||||
}
|
34
apilibs/kexbases/User32/ForegroundWindow.c
Normal file
34
apilibs/kexbases/User32/ForegroundWindow.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2009, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT AllowSetForegroundWindow_98=AllowSetForegroundWindow */
|
||||
BOOL WINAPI AllowSetForegroundWindow_98(DWORD procid)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT LockSetForegroundWindow_98=LockSetForegroundWindow */
|
||||
BOOL WINAPI LockSetForegroundWindow_98(UINT lockcode)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
35
apilibs/kexbases/User32/GetAncestor.c
Normal file
35
apilibs/kexbases/User32/GetAncestor.c
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
* Copyright (C) 1998-2001 Avery Lee
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "auxdecl.h"
|
||||
|
||||
//MAKE_EXPORT GetAncestor_fix=GetAncestor
|
||||
HWND APIENTRY GetAncestor_fix(HWND hwnd, UINT gaFlags)
|
||||
{
|
||||
// Believe it or not, HWND_MESSAGE works under Windows 98 -- and if you call GetAncestor()
|
||||
// on such a window, user32 crashes in 16-bit code. :(
|
||||
if (gaFlags == GA_ROOT && GetParent(hwnd) == NULL)
|
||||
return hwnd;
|
||||
|
||||
return GetAncestor(hwnd, gaFlags);
|
||||
}
|
31
apilibs/kexbases/User32/GetMouseMovePointsEx.c
Normal file
31
apilibs/kexbases/User32/GetMouseMovePointsEx.c
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2009, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "_user32_apilist.h"
|
||||
|
||||
GetMouseMovePoints_t GetMouseMovePoints_pfn;
|
||||
|
||||
/* MAKE_EXPORT GetMouseMovePointsEx_98=GetMouseMovePointsEx */
|
||||
int WINAPI GetMouseMovePointsEx_98(UINT size, LPMOUSEMOVEPOINT ptin, LPMOUSEMOVEPOINT ptout, int count, DWORD res)
|
||||
{
|
||||
return GetMouseMovePoints_pfn(size, ptin, ptout, count, res);
|
||||
}
|
29
apilibs/kexbases/User32/IsHungAppWindow.c
Normal file
29
apilibs/kexbases/User32/IsHungAppWindow.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "common.h"
|
||||
#include "_user32_apilist.h"
|
||||
|
||||
/* MAKE_EXPORT IsHungAppWindow_new=IsHungAppWindow */
|
||||
BOOL WINAPI IsHungAppWindow_new(HWND hWnd)
|
||||
{
|
||||
return IsHungThread_pfn(GetWindowThreadProcessId(hWnd, NULL));
|
||||
}
|
28
apilibs/kexbases/User32/LockWorkStation.c
Normal file
28
apilibs/kexbases/User32/LockWorkStation.c
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT LockWorkStation_new=LockWorkStation */
|
||||
BOOL WINAPI LockWorkStation_new(void)
|
||||
{
|
||||
//FIXME: rundll32 likes to call it and crashes because stack would be incorrect
|
||||
return WinExec("conlock.mod -uSeR",SW_SHOWDEFAULT) > 31 ? TRUE : FALSE;
|
||||
}
|
49
apilibs/kexbases/User32/MapVirtualKey_fix.c
Normal file
49
apilibs/kexbases/User32/MapVirtualKey_fix.c
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MapVirtualKey translation types */
|
||||
#define MAPVK_VK_TO_VSC 0
|
||||
#define MAPVK_VSC_TO_VK 1
|
||||
#define MAPVK_VK_TO_CHAR 2
|
||||
#define MAPVK_VSC_TO_VK_EX 3
|
||||
#define MAPVK_VK_TO_VSC_EX 4
|
||||
|
||||
/* MAKE_EXPORT MapVirtualKeyA_new=MapVirtualKeyA */
|
||||
UINT WINAPI MapVirtualKeyA_new(UINT uCode, UINT uMapType)
|
||||
{
|
||||
if (uMapType == MAPVK_VK_TO_VSC_EX)
|
||||
uMapType = MAPVK_VK_TO_VSC;
|
||||
else if (uMapType == MAPVK_VSC_TO_VK_EX)
|
||||
uMapType = MAPVK_VSC_TO_VK;
|
||||
return MapVirtualKeyA(uCode, uMapType);
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT MapVirtualKeyExA_new=MapVirtualKeyExA */
|
||||
UINT WINAPI MapVirtualKeyExA_new(UINT uCode, UINT uMapType, HKL dwhkl)
|
||||
{
|
||||
if (uMapType == MAPVK_VK_TO_VSC_EX)
|
||||
uMapType = MAPVK_VK_TO_VSC;
|
||||
else if (uMapType == MAPVK_VSC_TO_VK_EX)
|
||||
uMapType = MAPVK_VSC_TO_VK;
|
||||
return MapVirtualKeyExA(uCode, uMapType, dwhkl);
|
||||
}
|
85
apilibs/kexbases/User32/SendMessage_fix.c
Normal file
85
apilibs/kexbases/User32/SendMessage_fix.c
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT SendMessageA_fix=SendMessageA */
|
||||
__declspec(naked)
|
||||
LRESULT WINAPI SendMessageA_fix(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
__asm {
|
||||
mov eax, [esp+8] ;Msg
|
||||
cmp eax, 402 ;LB_SETTABSTOPS
|
||||
jz fix_settabstops
|
||||
cmp eax, 203 ;EM_SETTABSTOPS
|
||||
jz fix_settabstops
|
||||
orig_func:
|
||||
jmp dword ptr [SendMessageA]
|
||||
fix_settabstops:
|
||||
mov eax, [esp+12] ;wParam
|
||||
cmp eax, 0
|
||||
jbe orig_func ;sanity check: wParam > 0 ?
|
||||
shl eax, 2 ;wParam * sizeof(DWORD)
|
||||
push eax ;HeapAlloc.dwBytes
|
||||
push eax ;cb
|
||||
push dword ptr [esp+16+8]
|
||||
call dword ptr [IsBadReadPtr] ;sanity check: ok to read ?
|
||||
test eax, eax
|
||||
jz L2
|
||||
add esp, 4 ;can't read => return failure
|
||||
xor eax, eax
|
||||
ret 16
|
||||
L2:
|
||||
push 0
|
||||
call dword ptr [GetProcessHeap]
|
||||
push eax
|
||||
call dword ptr [HeapAlloc]
|
||||
test eax, eax
|
||||
jnz L3 ;alloc successful?
|
||||
ret 16
|
||||
L3:
|
||||
mov ecx, [esp+12]
|
||||
push esi
|
||||
push edi
|
||||
mov esi, [esp+16+8]
|
||||
mov edi, eax
|
||||
cld
|
||||
rep movsd
|
||||
pop edi
|
||||
pop esi
|
||||
push ebx
|
||||
mov ebx, eax ;alloc'd mem ptr
|
||||
push eax
|
||||
push dword ptr [esp+12+8]
|
||||
push dword ptr [esp+8+12]
|
||||
push dword ptr [esp+4+16]
|
||||
call dword ptr [SendMessageA]
|
||||
push eax ;remember result
|
||||
push ebx
|
||||
push 0
|
||||
call dword ptr [GetProcessHeap]
|
||||
push eax
|
||||
call dword ptr [HeapFree]
|
||||
pop eax ;remembered result
|
||||
pop ebx
|
||||
ret 16
|
||||
}
|
||||
}
|
134
apilibs/kexbases/User32/UberUSER.c
Normal file
134
apilibs/kexbases/User32/UberUSER.c
Normal file
@ -0,0 +1,134 @@
|
||||
/*
|
||||
* KernelEx
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
* 1997 Alex Korobka
|
||||
* Copyright 2002,2003 Shachar Shemesh
|
||||
* Copyright 2003 CodeWeavers Inc. (Ulrich Czekalla)
|
||||
*
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
static const char c_szUnicows[]="unicows.dll";
|
||||
static const char c_szUnicowsProp[]="GodotMemoryBlock";
|
||||
|
||||
static int WINAPI GetCPFromLocale(LCID Locale)
|
||||
{
|
||||
int cp;
|
||||
Locale = Locale & 0xFFFF; //we can assume that HKL == LCID in 9x... i hope :)
|
||||
if (GetLocaleInfoA(Locale,LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,(LPSTR)&cp,sizeof(int)))
|
||||
return cp;
|
||||
else
|
||||
return CP_ACP;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT ToUnicodeEx_new=ToUnicodeEx */
|
||||
int WINAPI ToUnicodeEx_new(
|
||||
UINT wVirtKey,
|
||||
UINT wScanCode,
|
||||
const PBYTE lpKeyState,
|
||||
LPWSTR pwszBuff,
|
||||
int cchBuff,
|
||||
UINT wFlags,
|
||||
HKL dwhkl
|
||||
)
|
||||
{
|
||||
int result;
|
||||
WORD asciibuf[4];
|
||||
char ansibuf[4];
|
||||
if (!lpKeyState || !pwszBuff)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
result = ToAsciiEx(wVirtKey,wScanCode,lpKeyState,asciibuf,wFlags,dwhkl);
|
||||
if (result && cchBuff)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < result; i++) ansibuf[i]=(char)asciibuf[i];
|
||||
MultiByteToWideChar(GetCPFromLocale((LCID)dwhkl),0,ansibuf,result,pwszBuff,cchBuff);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT ToUnicode_new=ToUnicode */
|
||||
int WINAPI ToUnicode_new(
|
||||
UINT wVirtKey,
|
||||
UINT wScanCode,
|
||||
const PBYTE lpKeyState,
|
||||
LPWSTR pwszBuff,
|
||||
int cchBuff,
|
||||
UINT wFlags
|
||||
)
|
||||
{
|
||||
return ToUnicodeEx_new(wVirtKey,wScanCode,lpKeyState,pwszBuff,cchBuff,wFlags,GetKeyboardLayout(GetCurrentThreadId()));
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetLastInputInfo_new=GetLastInputInfo */
|
||||
BOOL WINAPI GetLastInputInfo_new(
|
||||
PLASTINPUTINFO plii // last input event
|
||||
)
|
||||
{
|
||||
if ( !plii ) return FALSE;
|
||||
plii->dwTime = GetTickCount() - 123;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetMessageW_new=GetMessageW */
|
||||
BOOL WINAPI GetMessageW_new(
|
||||
LPMSG lpMsg, // message information
|
||||
HWND hWnd, // handle to window
|
||||
UINT wMsgFilterMin, // first message
|
||||
UINT wMsgFilterMax // last message
|
||||
)
|
||||
{
|
||||
BOOL result;
|
||||
/* HACKHACK ALERT: don't bother calling MSLU. We know how it works already. Win speed instead! */
|
||||
result = GetMessageA(lpMsg,hWnd,wMsgFilterMin,wMsgFilterMax);
|
||||
if (lpMsg && lpMsg->message == WM_CHAR && lpMsg->wParam > 0x7Fu && lpMsg->wParam <= 0xFFu && IsWindow(lpMsg->hwnd) && GetPropA(lpMsg->hwnd,c_szUnicowsProp))
|
||||
{
|
||||
WORD unichar;
|
||||
char ansichar = lpMsg->wParam;
|
||||
MultiByteToWideChar(GetCPFromLocale((LCID)GetKeyboardLayout(GetCurrentThreadId())),0,&ansichar,1,&unichar,1);
|
||||
lpMsg->wParam = unichar;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This fix is mainly for Winamp. Proper fix would be to hook SetWindowLongA too, but it's too hard and still,
|
||||
MSLU would fail to deliver right ANSI functions. Forget it!
|
||||
*/
|
||||
|
||||
/* MAKE_EXPORT GetWindowLongA_new=GetWindowLongA */
|
||||
LONG WINAPI GetWindowLongA_new(HWND hWnd, int nIndex)
|
||||
{
|
||||
LONG ret = GetWindowLongA( hWnd, nIndex );
|
||||
if ( nIndex == GWL_WNDPROC && ret & 0x80000000 && GetPropA(hWnd, c_szUnicowsProp) )
|
||||
{
|
||||
typedef HRESULT (WINAPI *GWLU) (HWND hWnd, int nIndex);
|
||||
GWLU GetWindowLongAU = (GWLU)GetProcAddress( GetModuleHandleA(c_szUnicows), "GetWindowLongA" );
|
||||
if ( GetWindowLongAU )
|
||||
{
|
||||
LONG retU = GetWindowLongAU( hWnd, nIndex );
|
||||
if ( retU ) return retU;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
45
apilibs/kexbases/User32/UpdateLayeredWindow.c
Normal file
45
apilibs/kexbases/User32/UpdateLayeredWindow.c
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Tihiy
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT UpdateLayeredWindow_new=UpdateLayeredWindow */
|
||||
BOOL WINAPI UpdateLayeredWindow_new(
|
||||
HWND hwnd, // handle to layered window
|
||||
HDC hdcDst, // handle to screen DC
|
||||
POINT *pptDst, // new screen position
|
||||
SIZE *psize, // new size of the layered window
|
||||
HDC hdcSrc, // handle to surface DC
|
||||
POINT *pptSrc, // layer position
|
||||
COLORREF crKey, // color key
|
||||
BLENDFUNCTION *pblend, // blend function
|
||||
DWORD dwFlags // options
|
||||
)
|
||||
{
|
||||
//pretty dumb stub for Firefox
|
||||
if ( hdcSrc && psize && pptSrc )
|
||||
{
|
||||
HDC hdc = GetDC( hwnd );
|
||||
BitBlt( hdc, 0, 0, psize->cx, psize->cy, hdcSrc, pptSrc->x, pptSrc->y, SRCCOPY );
|
||||
ReleaseDC( hwnd, hdc );
|
||||
}
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return FALSE;
|
||||
}
|
97
apilibs/kexbases/User32/_user32_apilist.c
Normal file
97
apilibs/kexbases/User32/_user32_apilist.c
Normal file
@ -0,0 +1,97 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_user32_apilist.h"
|
||||
|
||||
IsHungThread_t IsHungThread_pfn;
|
||||
DrawCaptionTempA_t DrawCaptionTempA_pfn;
|
||||
|
||||
BOOL init_user32()
|
||||
{
|
||||
HMODULE hUser32 = GetModuleHandle("USER32.DLL");
|
||||
|
||||
IsHungThread_pfn = (IsHungThread_t)GetProcAddress(hUser32, "IsHungThread");
|
||||
DrawCaptionTempA_pfn = (DrawCaptionTempA_t)GetProcAddress(hUser32, "DrawCaptionTempA");
|
||||
GetMouseMovePoints_pfn = (GetMouseMovePoints_t)GetProcAddress(hUser32, "GetMouseMovePoints");
|
||||
|
||||
return IsHungThread_pfn && DrawCaptionTempA_pfn && GetMouseMovePoints_pfn;
|
||||
}
|
||||
|
||||
/*
|
||||
* MAKE_EXPORT RealGetWindowClass=RealGetWindowClassA
|
||||
* MAKE_EXPORT GetAltTabInfo=GetAltTabInfoA
|
||||
* MAKE_EXPORT PeekMessageA=PeekMessageW
|
||||
* MAKE_EXPORT DispatchMessageA=DispatchMessageW
|
||||
* MAKE_EXPORT IsDialogMessageA=IsDialogMessageW
|
||||
* MAKE_EXPORT TranslateAcceleratorA=TranslateAcceleratorW
|
||||
* MAKE_EXPORT CopyAcceleratorTableA=CopyAcceleratorTableW
|
||||
* MAKE_EXPORT CreateAcceleratorTableA=CreateAcceleratorTableW
|
||||
* MAKE_EXPORT CallMsgFilterA=CallMsgFilterW
|
||||
*/
|
||||
|
||||
static const apilib_named_api user32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("AllowSetForegroundWindow", AllowSetForegroundWindow_98),
|
||||
DECL_API("CallMsgFilterW", CallMsgFilterA),
|
||||
DECL_API("CallWindowProcA", CallWindowProcA_fix),
|
||||
DECL_API("CopyAcceleratorTableW", CopyAcceleratorTableA),
|
||||
DECL_API("CreateAcceleratorTableW", CreateAcceleratorTableA),
|
||||
DECL_API("DisableProcessWindowsGhosting", DisableProcessWindowsGhosting_new),
|
||||
DECL_API("DispatchMessageW", DispatchMessageA),
|
||||
DECL_API("DrawCaptionTempW", DrawCaptionTempW_new),
|
||||
DECL_API("EnableWindow", EnableWindow_new),
|
||||
DECL_API("GetAltTabInfoA", GetAltTabInfo),
|
||||
DECL_API("GetAncestor", GetAncestor_fix),
|
||||
DECL_API("GetLastInputInfo", GetLastInputInfo_new),
|
||||
DECL_API("GetMessageW", GetMessageW_new),
|
||||
DECL_API("GetMouseMovePointsEx", GetMouseMovePointsEx_98),
|
||||
DECL_API("GetWindowLongA", GetWindowLongA_new),
|
||||
DECL_API("IsDialogMessageW", IsDialogMessageA),
|
||||
DECL_API("IsHungAppWindow", IsHungAppWindow_new),
|
||||
DECL_API("LoadStringW", LoadStringW_new),
|
||||
DECL_API("LockSetForegroundWindow", LockSetForegroundWindow_98),
|
||||
DECL_API("LockWorkStation", LockWorkStation_new),
|
||||
DECL_API("MapVirtualKeyA", MapVirtualKeyA_new),
|
||||
DECL_API("MapVirtualKeyExA", MapVirtualKeyExA_new),
|
||||
DECL_API("PeekMessageW", PeekMessageA),
|
||||
DECL_API("RealGetWindowClassA", RealGetWindowClass),
|
||||
DECL_API("RealGetWindowClassW", RealGetWindowClassW_new),
|
||||
DECL_API("SendMessageA", SendMessageA_fix),
|
||||
DECL_API("SetLayeredWindowAttributes", SetLayeredWindowAttributes_stub),
|
||||
DECL_API("ToUnicode", ToUnicode_new),
|
||||
DECL_API("ToUnicodeEx", ToUnicodeEx_new),
|
||||
DECL_API("TranslateAcceleratorW", TranslateAcceleratorA),
|
||||
DECL_API("UpdateLayeredWindow", UpdateLayeredWindow_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api user32_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_user32 = DECL_TAB("USER32.DLL", user32_named_apis, 0 /*user32_ordinal_apis*/);
|
63
apilibs/kexbases/User32/_user32_apilist.h
Normal file
63
apilibs/kexbases/User32/_user32_apilist.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _USER32_APILIST_H
|
||||
#define _USER32_APILIST_H
|
||||
|
||||
#include "auxdecl.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
typedef BOOL (WINAPI *IsHungThread_t)(DWORD ThreadID);
|
||||
extern IsHungThread_t IsHungThread_pfn;
|
||||
typedef BOOL (WINAPI *DrawCaptionTempA_t)(HWND, HDC, const RECT*, HFONT, HICON, LPCSTR, UINT);
|
||||
extern DrawCaptionTempA_t DrawCaptionTempA_pfn;
|
||||
typedef int (WINAPI *GetMouseMovePoints_t)(UINT,LPMOUSEMOVEPOINT,LPMOUSEMOVEPOINT,int,DWORD);
|
||||
extern GetMouseMovePoints_t GetMouseMovePoints_pfn;
|
||||
|
||||
BOOL init_user32();
|
||||
extern const apilib_api_table apitable_user32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
LRESULT WINAPI CallWindowProcA_fix(WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
void __stdcall DisableProcessWindowsGhosting_new(void);
|
||||
BOOL WINAPI EnableWindow_new(HWND hWnd, BOOL bEnable);
|
||||
BOOL WINAPI AllowSetForegroundWindow_98(DWORD procid);
|
||||
BOOL WINAPI LockSetForegroundWindow_98(UINT lockcode);
|
||||
HWND APIENTRY GetAncestor_fix(HWND hwnd, UINT gaFlags);
|
||||
int WINAPI GetMouseMovePointsEx_98(UINT size, LPMOUSEMOVEPOINT ptin, LPMOUSEMOVEPOINT ptout, int count, DWORD res);
|
||||
BOOL WINAPI IsHungAppWindow_new(HWND hWnd);
|
||||
BOOL WINAPI LockWorkStation_new(void);
|
||||
UINT WINAPI MapVirtualKeyA_new(UINT uCode, UINT uMapType);
|
||||
UINT WINAPI MapVirtualKeyExA_new(UINT uCode, UINT uMapType, HKL dwhkl);
|
||||
LRESULT WINAPI SendMessageA_fix(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
|
||||
int WINAPI ToUnicodeEx_new(UINT wVirtKey, UINT wScanCode, const PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags, HKL dwhkl);
|
||||
int WINAPI ToUnicode_new(UINT wVirtKey, UINT wScanCode, const PBYTE lpKeyState, LPWSTR pwszBuff, int cchBuff, UINT wFlags);
|
||||
BOOL WINAPI GetLastInputInfo_new(PLASTINPUTINFO plii);
|
||||
BOOL WINAPI GetMessageW_new(LPMSG lpMsg, HWND hWnd, UINT wMsgFilterMin, UINT wMsgFilterMax);
|
||||
LONG WINAPI GetWindowLongA_new(HWND hWnd, int nIndex);
|
||||
BOOL WINAPI UpdateLayeredWindow_new(HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psize, HDC hdcSrc, POINT *pptSrc, COLORREF crKey, BLENDFUNCTION *pblend, DWORD dwFlags);
|
||||
STUB SetLayeredWindowAttributes_stub;
|
||||
BOOL WINAPI DrawCaptionTempW_new(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR strW, UINT uFlags);
|
||||
int WINAPI LoadStringW_new(HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int nBufferMax);
|
||||
UINT WINAPI RealGetWindowClassW_new(HWND hwnd, LPWSTR pszTypeW, UINT cchType);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
24
apilibs/kexbases/User32/_user32_stubs.c
Normal file
24
apilibs/kexbases/User32/_user32_stubs.c
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
UNIMPL_FUNC(SetLayeredWindowAttributes, 4);
|
91
apilibs/kexbases/User32/uniuser32.c
Normal file
91
apilibs/kexbases/User32/uniuser32.c
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "_user32_apilist.h"
|
||||
#include <commctrl.h>
|
||||
|
||||
/* MAKE_EXPORT DrawCaptionTempW_new=DrawCaptionTempW */
|
||||
BOOL WINAPI DrawCaptionTempW_new(HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR strW, UINT uFlags)
|
||||
{
|
||||
if (!(uFlags & DC_TEXT) || !strW)
|
||||
return DrawCaptionTempA_pfn(hwnd, hdc, rect, hFont, hIcon, (LPCSTR)strW, uFlags);
|
||||
else
|
||||
{
|
||||
ALLOC_WtoA(str);
|
||||
return DrawCaptionTempA_pfn(hwnd, hdc, rect, hFont, hIcon, strA, uFlags);
|
||||
}
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT LoadStringW_new=LoadStringW */
|
||||
int WINAPI LoadStringW_new(HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int nBufferMax)
|
||||
{
|
||||
int len;
|
||||
LPWSTR wstr;
|
||||
|
||||
len = 0;
|
||||
if (lpBuffer)
|
||||
{
|
||||
// find stringtable resource
|
||||
HRSRC res = FindResourceA(hInstance, MAKEINTRESOURCE((uID >> 4) + 1), RT_STRING);
|
||||
if (res)
|
||||
{
|
||||
// load stringtable resource
|
||||
HGLOBAL data = LoadResource(hInstance, res);
|
||||
if (data)
|
||||
{
|
||||
// find string in stringtable
|
||||
uID &= 0xf;
|
||||
do
|
||||
{
|
||||
len = *(WORD*)data;
|
||||
wstr = (LPWSTR)data + 1;
|
||||
data = (HGLOBAL)(wstr + len);
|
||||
}
|
||||
while (uID--);
|
||||
// if nBufferMax is zero, then lpBuffer receives pointer to the resource itself
|
||||
if (!nBufferMax)
|
||||
{
|
||||
*(LPWSTR*)lpBuffer = wstr;
|
||||
return len;
|
||||
}
|
||||
if (len > nBufferMax - 1)
|
||||
{
|
||||
len = nBufferMax - 1;
|
||||
}
|
||||
memcpy(lpBuffer, wstr, len * sizeof(WCHAR));
|
||||
}
|
||||
}
|
||||
lpBuffer[len] = 0;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT RealGetWindowClassW_new=RealGetWindowClassW */
|
||||
UINT WINAPI RealGetWindowClassW_new(HWND hwnd, LPWSTR pszTypeW, UINT cchType)
|
||||
{
|
||||
UINT ret;
|
||||
ALLOC_A(pszType, cchType * acp_mcs);
|
||||
ret = RealGetWindowClass(hwnd, pszTypeA, cchType * acp_mcs);
|
||||
if (ret)
|
||||
ret = ABUFtoW(pszType, ret, cchType);
|
||||
return ret;
|
||||
}
|
136
apilibs/kexbases/auxdecl.h
Normal file
136
apilibs/kexbases/auxdecl.h
Normal file
@ -0,0 +1,136 @@
|
||||
/* This file contains required declarations missing from MINGW and MSVC6 without PSDK */
|
||||
|
||||
#ifndef __AUXDECL_H
|
||||
#define __AUXDECL_H
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* declarations for MSVC6 without PSDK */
|
||||
#if defined (_MSC_VER) && (WINVER < 0x0500)
|
||||
|
||||
#define VER_MINORVERSION 0x0000001
|
||||
#define VER_MAJORVERSION 0x0000002
|
||||
#define VER_BUILDNUMBER 0x0000004
|
||||
#define VER_PLATFORMID 0x0000008
|
||||
#define VER_SERVICEPACKMINOR 0x0000010
|
||||
#define VER_SERVICEPACKMAJOR 0x0000020
|
||||
#define VER_SUITENAME 0x0000040
|
||||
#define VER_PRODUCT_TYPE 0x0000080
|
||||
#define VER_EQUAL 1
|
||||
#define VER_GREATER 2
|
||||
#define VER_GREATER_EQUAL 3
|
||||
#define VER_LESS 4
|
||||
#define VER_LESS_EQUAL 5
|
||||
#define VER_AND 6
|
||||
#define VER_OR 7
|
||||
|
||||
#define VER_NT_WORKSTATION 1
|
||||
#define VER_NT_DOMAIN_CONTROLLER 2
|
||||
#define VER_NT_SERVER 3
|
||||
#define VER_SUITE_SMALLBUSINESS 1
|
||||
#define VER_SUITE_ENTERPRISE 2
|
||||
#define VER_SUITE_BACKOFFICE 4
|
||||
#define VER_SUITE_TERMINAL 16
|
||||
#define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
|
||||
#define VER_SUITE_EMBEDDEDNT 64
|
||||
#define VER_SUITE_DATACENTER 128
|
||||
#define VER_SUITE_SINGLEUSERTS 256
|
||||
#define VER_SUITE_PERSONAL 512
|
||||
#define VER_SUITE_BLADE 1024
|
||||
#define VER_SUITE_STORAGE_SERVER 8192
|
||||
#define VER_SUITE_COMPUTE_SERVER 16384
|
||||
|
||||
#define OSVERSIONINFOEXA __OSVERSIONINFOEXA
|
||||
#define POSVERSIONINFOEXA __POSVERSIONINFOEXA
|
||||
#define LPOSVERSIONINFOEXA __LPOSVERSIONINFOEXA
|
||||
#define OSVERSIONINFOEXW __OSVERSIONINFOEXW
|
||||
#define POSVERSIONINFOEXW __POSVERSIONINFOEXW
|
||||
#define LPOSVERSIONINFOEXW __LPOSVERSIONINFOEXW
|
||||
|
||||
typedef struct {
|
||||
DWORD dwOSVersionInfoSize;
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwMinorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformId;
|
||||
CHAR szCSDVersion[128];
|
||||
WORD wServicePackMajor;
|
||||
WORD wServicePackMinor;
|
||||
WORD wSuiteMask;
|
||||
BYTE wProductType;
|
||||
BYTE wReserved;
|
||||
} __OSVERSIONINFOEXA, *__POSVERSIONINFOEXA, *__LPOSVERSIONINFOEXA;
|
||||
typedef struct {
|
||||
DWORD dwOSVersionInfoSize;
|
||||
DWORD dwMajorVersion;
|
||||
DWORD dwMinorVersion;
|
||||
DWORD dwBuildNumber;
|
||||
DWORD dwPlatformId;
|
||||
WCHAR szCSDVersion[128];
|
||||
WORD wServicePackMajor;
|
||||
WORD wServicePackMinor;
|
||||
WORD wSuiteMask;
|
||||
BYTE wProductType;
|
||||
BYTE wReserved;
|
||||
} __OSVERSIONINFOEXW, *__POSVERSIONINFOEXW, *__LPOSVERSIONINFOEXW;
|
||||
|
||||
typedef long LONG_PTR;
|
||||
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCA)(LPSTR, LONG_PTR);
|
||||
typedef BOOL (CALLBACK *UILANGUAGE_ENUMPROCW)(LPWSTR, LONG_PTR);
|
||||
|
||||
#define MEMORYSTATUSEX __MEMORYSTATUSEX
|
||||
#define PMEMORYSTATUSEX __PMEMORYSTATUSEX
|
||||
#define LPMEMORYSTATUSEX __LPMEMORYSTATUSEX
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwLength;
|
||||
DWORD dwMemoryLoad;
|
||||
DWORDLONG ullTotalPhys;
|
||||
DWORDLONG ullAvailPhys;
|
||||
DWORDLONG ullTotalPageFile;
|
||||
DWORDLONG ullAvailPageFile;
|
||||
DWORDLONG ullTotalVirtual;
|
||||
DWORDLONG ullAvailVirtual;
|
||||
DWORDLONG ullAvailExtendedVirtual;
|
||||
} __MEMORYSTATUSEX, *__PMEMORYSTATUSEX, *__LPMEMORYSTATUSEX;
|
||||
|
||||
typedef enum {
|
||||
SHGFP_TYPE_CURRENT = 0,
|
||||
SHGFP_TYPE_DEFAULT = 1,
|
||||
} SHGFP_TYPE;
|
||||
|
||||
#define GA_ROOT 2
|
||||
|
||||
typedef void *LPPRINTDLGEX;
|
||||
typedef void *LPMOUSEMOVEPOINT;
|
||||
|
||||
EXTERN_C int WINAPI GetRandomRgn(HDC hdc, HRGN hrgn, INT iNum);
|
||||
EXTERN_C HRESULT WINAPI SHGetFolderPathA(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath);
|
||||
EXTERN_C HWND WINAPI GetAncestor(HWND hwnd, UINT gaFlags);
|
||||
EXTERN_C UINT WINAPI RealGetWindowClass(HWND hwnd, LPTSTR pszType, UINT cchType);
|
||||
|
||||
#endif /* defined (_MSC_VER) && (WINVER < 0x0500) */
|
||||
|
||||
|
||||
/* declarations for MINGW32 */
|
||||
#ifdef __MINGW32_VERSION
|
||||
|
||||
/* The security descriptor structure */
|
||||
typedef struct {
|
||||
BYTE Revision;
|
||||
BYTE Sbz1;
|
||||
SECURITY_DESCRIPTOR_CONTROL Control;
|
||||
DWORD Owner;
|
||||
DWORD Group;
|
||||
DWORD Sacl;
|
||||
DWORD Dacl;
|
||||
} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
|
||||
|
||||
#endif /* __MINGW32_VERSION */
|
||||
|
||||
/* declarations for everyone */
|
||||
EXTERN_C BOOL WINAPI GetAltTabInfo(HWND,int,PVOID,LPSTR,UINT);
|
||||
|
||||
#endif /* __AUXDECL_H */
|
31
apilibs/kexbases/comdlg32/PrintDlgEx.c
Normal file
31
apilibs/kexbases/comdlg32/PrintDlgEx.c
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "auxdecl.h"
|
||||
|
||||
/* MAKE_EXPORT PrintDlgEx_new=PrintDlgExA
|
||||
* MAKE_EXPORT PrintDlgEx_new=PrintDlgExW
|
||||
*/
|
||||
HRESULT WINAPI PrintDlgEx_new(LPPRINTDLGEX lppd)
|
||||
{
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
return E_NOTIMPL;
|
||||
}
|
47
apilibs/kexbases/comdlg32/_comdlg32_apilist.c
Normal file
47
apilibs/kexbases/comdlg32/_comdlg32_apilist.c
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_comdlg32_apilist.h"
|
||||
|
||||
BOOL init_comdlg32()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const apilib_named_api comdlg32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("PrintDlgExA", PrintDlgEx_new),
|
||||
DECL_API("PrintDlgExW", PrintDlgEx_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api comdlg32_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_comdlg32 = DECL_TAB("COMDLG32.DLL", comdlg32_named_apis, 0 /*comdlg32_ordinal_apis*/);
|
35
apilibs/kexbases/comdlg32/_comdlg32_apilist.h
Normal file
35
apilibs/kexbases/comdlg32/_comdlg32_apilist.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _COMDLG32_APILIST_H
|
||||
#define _COMDLG32_APILIST_H
|
||||
|
||||
#include "auxdecl.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_comdlg32();
|
||||
extern const apilib_api_table apitable_comdlg32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
HRESULT WINAPI PrintDlgEx_new(LPPRINTDLGEX lppd);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
52
apilibs/kexbases/common.c
Normal file
52
apilibs/kexbases/common.c
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
int acp_mcs;
|
||||
|
||||
static int GetMaxCharSize(UINT CodePage)
|
||||
{
|
||||
CPINFO cpi;
|
||||
if (!GetCPInfo(CodePage, &cpi))
|
||||
return 2;
|
||||
return cpi.MaxCharSize;
|
||||
}
|
||||
|
||||
BOOL common_init(void)
|
||||
{
|
||||
acp_mcs = GetMaxCharSize(CP_ACP);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
char* file_fixWprefix(char* in)
|
||||
{
|
||||
if (*(int *)in == 0x5c3f5c5c) //if (!strncmp(in, "\\?\", 4))
|
||||
{
|
||||
in += 4;
|
||||
if (*(int *)in == 0x5c434e55) //if (!strncmp(in, "UNC\", 4))
|
||||
{
|
||||
in += 2;
|
||||
*in = '\\';
|
||||
}
|
||||
}
|
||||
return in;
|
||||
}
|
113
apilibs/kexbases/common.h
Normal file
113
apilibs/kexbases/common.h
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __COMMON_H
|
||||
#define __COMMON_H
|
||||
|
||||
#include <windows.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int __stdcall STUB(void);
|
||||
typedef int __stdcall FWDPROC(void);
|
||||
|
||||
extern int acp_mcs;
|
||||
BOOL common_init(void);
|
||||
int WINAPI CommonUnimpStub(void);
|
||||
char* file_fixWprefix(char* in);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define UNIMPL_FUNC(name,params) \
|
||||
__asm__( ".text\n" \
|
||||
".globl _" #name "_stub@0\n" \
|
||||
"_" #name "_new@0:\n\t" \
|
||||
"xor %eax, %eax\n\t" \
|
||||
"movb $" #params ", %cl\n\t" \
|
||||
"jmp _CommonUnimpStub@0\n\t" \
|
||||
)
|
||||
#else
|
||||
#define UNIMPL_FUNC(name,params) \
|
||||
int __declspec(naked) __stdcall name##_stub() \
|
||||
{ \
|
||||
__asm xor eax,eax \
|
||||
__asm mov cl, params \
|
||||
__asm jmp CommonUnimpStub \
|
||||
}
|
||||
#endif
|
||||
|
||||
#define AtoW(str, bsize) MultiByteToWideChar(CP_ACP, 0, str##A, -1, str##W, bsize)
|
||||
#define WtoA(str, bsize) WideCharToMultiByte(CP_ACP, 0, str##W, -1, str##A, bsize, NULL, NULL)
|
||||
|
||||
#define _ALLOC_WtoA(str) \
|
||||
const WCHAR* p; \
|
||||
int c; \
|
||||
for (p = str##W ; *p ; p++); \
|
||||
c = (int) p - (int) str##W; \
|
||||
c *= acp_mcs; \
|
||||
str##A = (char*) alloca(c); \
|
||||
WtoA(str, c)
|
||||
|
||||
|
||||
#define ALLOC_WtoA(str) \
|
||||
char* str##A; \
|
||||
if (str##W) \
|
||||
{ \
|
||||
_ALLOC_WtoA(str); \
|
||||
} \
|
||||
else str##A = NULL
|
||||
|
||||
#define ALLOC_A(str, cnt) \
|
||||
char* str##A = str##W ? ((char*) alloca(cnt)) : NULL
|
||||
|
||||
#define ABUFtoW(str, inbsize, outbsize) \
|
||||
MultiByteToWideChar(CP_ACP, 0, str##A, inbsize, str##W, outbsize)
|
||||
|
||||
#define file_GetCP() \
|
||||
UINT file_CP = AreFileApisANSI() ? CP_ACP : CP_OEMCP
|
||||
#define file_AtoW(str, bsize) MultiByteToWideChar(file_CP, 0, str##A, -1, str##W, bsize)
|
||||
#define file_WtoA(str, bsize) WideCharToMultiByte(file_CP, 0, str##W, -1, str##A, bsize, "_", NULL); \
|
||||
str##A = file_fixWprefix(str##A)
|
||||
|
||||
#define file_ALLOC_WtoA(str) \
|
||||
char* str##A; \
|
||||
if (str##W) \
|
||||
{ \
|
||||
const WCHAR* p; \
|
||||
int c; \
|
||||
for (p = str##W ; *p ; p++); \
|
||||
c = (int) p - (int) str##W; \
|
||||
c *= acp_mcs; \
|
||||
str##A = (char*) alloca(c); \
|
||||
file_WtoA(str, c); \
|
||||
} \
|
||||
else str##A = NULL
|
||||
|
||||
#define file_ABUFtoW(str, cntsrc, bsize) \
|
||||
MultiByteToWideChar(file_CP, 0, str##A, cntsrc, str##W, bsize)
|
||||
|
||||
#endif
|
7
apilibs/kexbases/dirlist
Normal file
7
apilibs/kexbases/dirlist
Normal file
@ -0,0 +1,7 @@
|
||||
kernel32
|
||||
user32
|
||||
gdi32
|
||||
advapi32
|
||||
comdlg32
|
||||
shell32
|
||||
version
|
14
apilibs/kexbases/kernel32ord.def
Normal file
14
apilibs/kexbases/kernel32ord.def
Normal file
@ -0,0 +1,14 @@
|
||||
LIBRARY KERNEL32.dll
|
||||
|
||||
EXPORTS
|
||||
CommonUnimpStub@0 @17 NONAME
|
||||
VxDCall1@4 @1 NONAME
|
||||
VxDCall2@8 @2 NONAME
|
||||
VxDCall3@12 @3 NONAME
|
||||
VxDCall4@16 @4 NONAME
|
||||
VxDCall5@20 @5 NONAME
|
||||
VxDCall6@24 @6 NONAME
|
||||
VxDCall7@28 @7 NONAME
|
||||
VxDCall8@32 @8 NONAME
|
||||
_EnterSysLevel@4 @97 NONAME
|
||||
_LeaveSysLevel@4 @98 NONAME
|
8
apilibs/kexbases/kexbases.def
Normal file
8
apilibs/kexbases/kexbases.def
Normal file
@ -0,0 +1,8 @@
|
||||
LIBRARY kexbases.dll BASE=0xBFA40000
|
||||
SECTIONS
|
||||
.text SHARED
|
||||
.bss SHARED
|
||||
.data SHARED
|
||||
.edata SHARED
|
||||
.rdata SHARED
|
||||
.idata SHARED
|
467
apilibs/kexbases/kexbases.dsp
Normal file
467
apilibs/kexbases/kexbases.dsp
Normal file
@ -0,0 +1,467 @@
|
||||
# Microsoft Developer Studio Project File - Name="KernelEx Base Shared" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=KernelEx Base Shared - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "kexbases.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "kexbases.mak" CFG="KernelEx Base Shared - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "KernelEx Base Shared - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "KernelEx Base Shared - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "KernelEx Base Shared - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KERNELEXBASESHARED_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /O2 /I "." /I "../../common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x0500 /YX /FD /TP /GF /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x415 /d "NDEBUG"
|
||||
# ADD RSC /l 0x415 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib version.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib /nologo /dll /map /machine:I386 /nodefaultlib /ignore:4092 /OPT:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ELSEIF "$(CFG)" == "KernelEx Base Shared - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KERNELEXBASESHARED_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "." /I "../../common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D _WIN32_WINNT=0x0500 /YX /FD /TP /GZ /GF /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x415 /d "_DEBUG"
|
||||
# ADD RSC /l 0x415 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib version.lib ../../common/KernelEx.lib ../../kexcrt/kexcrt.lib libc.lib /nologo /dll /map /debug /machine:I386 /nodefaultlib /pdbtype:sept /ignore:4092 /OPT:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "KernelEx Base Shared - Win32 Release"
|
||||
# Name "KernelEx Base Shared - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Group "kernel32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\_kernel32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\_kernel32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\_kernel32_stubs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\CopyFileEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\CreateFileA_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\CreateThread_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\DeleteCriticalSection.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\GetFileSizeEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\GlobalMemoryStatusEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\HeapLocks.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\InitializeCriticalSectionAndSpinCount.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\Jobs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\KEXVersion.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\LockFileEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\MapViewOfFile.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\MoveFileExA.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\MoveFileWithProgressA.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\OpenThread.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\SetFilePointerEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\ThreadPool.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\TryEnterCriticalSection.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\uilang.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\unikernel32.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\version.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Kernel32\VirtualAllocEx.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "user32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\_user32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\_user32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\_user32_stubs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\CallWindowProcA_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\DisableProcessWindowsGhosting.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\EnableWindow.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\ForegroundWindow.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\GetAncestor.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\GetMouseMovePointsEx.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\IsHungAppWindow.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\LockWorkStation.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\MapVirtualKey_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\SendMessage_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\UberUSER.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\uniuser32.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\User32\UpdateLayeredWindow.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "gdi32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\_gdi32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\_gdi32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\_gdi32_stubs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\FontResourceExA.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\GetGlyphOutlineA_fix.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\TextOut.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Gdi32\unigdi32.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "advapi32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\_advapi32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\_advapi32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\_advapi32_stubs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\RegDisablePredefinedCache.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\RegOpenCurrentUser.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\security.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\TraceMessage.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Advapi32\uniadvapi32.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "comdlg32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comdlg32\_comdlg32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comdlg32\_comdlg32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\comdlg32\PrintDlgEx.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "version"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\version\_version_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\version\_version_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\version\universion.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "shell32"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\_shell32_apilist.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\_shell32_apilist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\_shell32_stubs.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\CommandLineToArgvW.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\shell32\IsUserAnAdmin.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\kernel32ord.def
|
||||
# PROP Exclude_From_Build 1
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\kexbases.def
|
||||
|
||||
!IF "$(CFG)" == "KernelEx Base Shared - Win32 Release"
|
||||
|
||||
# Begin Custom Build
|
||||
OutDir=.\Release
|
||||
ProjDir=.
|
||||
InputPath=.\kexbases.def
|
||||
|
||||
BuildCmds= \
|
||||
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$(ProjDir)\kernel32ord.def /OUT:$(OutDir)\kernel32ord.lib
|
||||
|
||||
"$(OutDir)\kernel32ord.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(OutDir)\kernel32ord.exp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "KernelEx Base Shared - Win32 Debug"
|
||||
|
||||
# Begin Custom Build
|
||||
OutDir=.\Debug
|
||||
ProjDir=.
|
||||
InputPath=.\kexbases.def
|
||||
|
||||
BuildCmds= \
|
||||
link /LIB /NOLOGO /MACHINE:IX86 /DEF:$(ProjDir)\kernel32ord.def /OUT:$(OutDir)\kernel32ord.lib
|
||||
|
||||
"$(OutDir)\kernel32ord.lib" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
|
||||
"$(OutDir)\kernel32ord.exp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
$(BuildCmds)
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\auxdecl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\kexbases.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
109
apilibs/kexbases/kexbases.rc
Normal file
109
apilibs/kexbases/kexbases.rc
Normal file
@ -0,0 +1,109 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Polish resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
|
||||
#pragma code_page(1250)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 4,0,1,0
|
||||
PRODUCTVERSION 4,0,1,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x40004L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "000004b0"
|
||||
BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "Xeno86\0"
|
||||
VALUE "FileDescription", "KernelEx Base Shared Api Library\0"
|
||||
VALUE "FileVersion", "4, 0, 1, 0\0"
|
||||
VALUE "InternalName", "kexbases\0"
|
||||
VALUE "LegalCopyright", "Copyright <20> 2009, Xeno86\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "kexbases.dll\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "KernelEx\0"
|
||||
VALUE "ProductVersion", "4, 0, 1, 0\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
#endif // Polish resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
79
apilibs/kexbases/main.c
Normal file
79
apilibs/kexbases/main.c
Normal file
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "kernel32/_kernel32_apilist.h"
|
||||
#include "gdi32/_gdi32_apilist.h"
|
||||
#include "user32/_user32_apilist.h"
|
||||
#include "advapi32/_advapi32_apilist.h"
|
||||
#include "comdlg32/_comdlg32_apilist.h"
|
||||
#include "shell32/_shell32_apilist.h"
|
||||
#include "version/_version_apilist.h"
|
||||
//#include "/__apilist.h"
|
||||
|
||||
static LONG inited = 0;
|
||||
static apilib_api_table api_table[8];
|
||||
|
||||
static void fill_apitable()
|
||||
{
|
||||
api_table[0] = apitable_kernel32;
|
||||
api_table[1] = apitable_gdi32;
|
||||
api_table[2] = apitable_user32;
|
||||
api_table[3] = apitable_advapi32;
|
||||
api_table[4] = apitable_comdlg32;
|
||||
api_table[5] = apitable_shell32;
|
||||
api_table[6] = apitable_version;
|
||||
//last entry is null terminator
|
||||
}
|
||||
|
||||
extern "C"
|
||||
__declspec(dllexport)
|
||||
const apilib_api_table* get_api_table()
|
||||
{
|
||||
fill_apitable();
|
||||
return api_table;
|
||||
}
|
||||
|
||||
BOOL init_once()
|
||||
{
|
||||
return common_init() && init_kernel32() && init_gdi32() && init_user32() && init_advapi32() && init_comdlg32() && init_shell32() && init_version();
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HINSTANCE instance, DWORD reason, BOOL load_static)
|
||||
{
|
||||
switch (reason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
// kexDebugPrint("KernelEx Base Shared library reporting in action!\n");
|
||||
DisableThreadLibraryCalls(instance);
|
||||
if (InterlockedExchange(&inited, 1) == 0)
|
||||
{
|
||||
if (!init_once())
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
// kexDebugPrint("KernelEx Base Shared library signing off!\n");
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
15
apilibs/kexbases/resource.h
Normal file
15
apilibs/kexbases/resource.h
Normal file
@ -0,0 +1,15 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by kexbases.rc
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
202
apilibs/kexbases/shell32/CommandLineToArgvW.c
Normal file
202
apilibs/kexbases/shell32/CommandLineToArgvW.c
Normal file
@ -0,0 +1,202 @@
|
||||
/*
|
||||
* Shell basics
|
||||
*
|
||||
* Copyright 1998 Marcus Meissner
|
||||
* Copyright 1998 Juergen Schmied (jsch) * <juergen.schmied@metronet.de>
|
||||
*
|
||||
* 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 <windows.h>
|
||||
|
||||
/*************************************************************************
|
||||
* CommandLineToArgvW [SHELL32.@]
|
||||
*
|
||||
* We must interpret the quotes in the command line to rebuild the argv
|
||||
* array correctly:
|
||||
* - arguments are separated by spaces or tabs
|
||||
* - quotes serve as optional argument delimiters
|
||||
* '"a b"' -> 'a b'
|
||||
* - escaped quotes must be converted back to '"'
|
||||
* '\"' -> '"'
|
||||
* - an odd number of '\'s followed by '"' correspond to half that number
|
||||
* of '\' followed by a '"' (extension of the above)
|
||||
* '\\\"' -> '\"'
|
||||
* '\\\\\"' -> '\\"'
|
||||
* - an even number of '\'s followed by a '"' correspond to half that number
|
||||
* of '\', plus a regular quote serving as an argument delimiter (which
|
||||
* means it does not appear in the result)
|
||||
* 'a\\"b c"' -> 'a\b c'
|
||||
* 'a\\\\"b c"' -> 'a\\b c'
|
||||
* - '\' that are not followed by a '"' are copied literally
|
||||
* 'a\b' -> 'a\b'
|
||||
* 'a\\b' -> 'a\\b'
|
||||
*
|
||||
* Note:
|
||||
* '\t' == 0x0009
|
||||
* ' ' == 0x0020
|
||||
* '"' == 0x0022
|
||||
* '\\' == 0x005c
|
||||
*/
|
||||
|
||||
/* MAKE_EXPORT CommandLineToArgvW_new=CommandLineToArgvW */
|
||||
LPWSTR* WINAPI CommandLineToArgvW_new(LPCWSTR lpCmdline, int* numargs)
|
||||
{
|
||||
DWORD argc;
|
||||
LPWSTR *argv;
|
||||
LPCWSTR cs;
|
||||
LPWSTR arg,s,d;
|
||||
LPWSTR cmdline;
|
||||
int in_quotes,bcount;
|
||||
|
||||
if (*lpCmdline==0)
|
||||
{
|
||||
/* Return the path to the executable */
|
||||
DWORD len, size=16;
|
||||
|
||||
argv=(LPWSTR*)LocalAlloc(LMEM_FIXED, size);
|
||||
for (;;)
|
||||
{
|
||||
len = GetModuleFileNameW(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR));
|
||||
if (!len)
|
||||
{
|
||||
LocalFree(argv);
|
||||
return NULL;
|
||||
}
|
||||
if (len < size) break;
|
||||
size*=2;
|
||||
argv=(LPWSTR*)LocalReAlloc(argv, size, 0);
|
||||
}
|
||||
argv[0]=(LPWSTR)(argv+1);
|
||||
if (numargs)
|
||||
*numargs=2;
|
||||
|
||||
return argv;
|
||||
}
|
||||
|
||||
/* to get a writable copy */
|
||||
argc=0;
|
||||
bcount=0;
|
||||
in_quotes=0;
|
||||
cs=lpCmdline;
|
||||
while (1)
|
||||
{
|
||||
if (*cs==0 || ((*cs==0x0009 || *cs==0x0020) && !in_quotes))
|
||||
{
|
||||
/* space */
|
||||
argc++;
|
||||
/* skip the remaining spaces */
|
||||
while (*cs==0x0009 || *cs==0x0020) {
|
||||
cs++;
|
||||
}
|
||||
if (*cs==0)
|
||||
break;
|
||||
bcount=0;
|
||||
continue;
|
||||
}
|
||||
else if (*cs==0x005c)
|
||||
{
|
||||
/* '\', count them */
|
||||
bcount++;
|
||||
}
|
||||
else if ((*cs==0x0022) && ((bcount & 1)==0))
|
||||
{
|
||||
/* unescaped '"' */
|
||||
in_quotes=!in_quotes;
|
||||
bcount=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* a regular character */
|
||||
bcount=0;
|
||||
}
|
||||
cs++;
|
||||
}
|
||||
/* Allocate in a single lump, the string array, and the strings that go with it.
|
||||
* This way the caller can make a single GlobalFree call to free both, as per MSDN.
|
||||
*/
|
||||
argv=(LPWSTR*)LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(lstrlenW(lpCmdline)+1)*sizeof(WCHAR));
|
||||
if (!argv)
|
||||
return NULL;
|
||||
cmdline=(LPWSTR)(argv+argc);
|
||||
lstrcpyW(cmdline, lpCmdline);
|
||||
|
||||
argc=0;
|
||||
bcount=0;
|
||||
in_quotes=0;
|
||||
arg=d=s=cmdline;
|
||||
while (*s)
|
||||
{
|
||||
if ((*s==0x0009 || *s==0x0020) && !in_quotes)
|
||||
{
|
||||
/* Close the argument and copy it */
|
||||
*d=0;
|
||||
argv[argc++]=arg;
|
||||
|
||||
/* skip the remaining spaces */
|
||||
do {
|
||||
s++;
|
||||
} while (*s==0x0009 || *s==0x0020);
|
||||
|
||||
/* Start with a new argument */
|
||||
arg=d=s;
|
||||
bcount=0;
|
||||
}
|
||||
else if (*s==0x005c)
|
||||
{
|
||||
/* '\\' */
|
||||
*d++=*s++;
|
||||
bcount++;
|
||||
}
|
||||
else if (*s==0x0022)
|
||||
{
|
||||
/* '"' */
|
||||
if ((bcount & 1)==0)
|
||||
{
|
||||
/* Preceded by an even number of '\', this is half that
|
||||
* number of '\', plus a quote which we erase.
|
||||
*/
|
||||
d-=bcount/2;
|
||||
in_quotes=!in_quotes;
|
||||
s++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Preceded by an odd number of '\', this is half that
|
||||
* number of '\' followed by a '"'
|
||||
*/
|
||||
d=d-bcount/2-1;
|
||||
*d++='"';
|
||||
s++;
|
||||
}
|
||||
bcount=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* a regular character */
|
||||
*d++=*s++;
|
||||
bcount=0;
|
||||
}
|
||||
}
|
||||
if (*arg)
|
||||
{
|
||||
*d='\0';
|
||||
argv[argc++]=arg;
|
||||
}
|
||||
if (numargs)
|
||||
*numargs=argc;
|
||||
|
||||
return argv;
|
||||
}
|
28
apilibs/kexbases/shell32/IsUserAnAdmin.c
Normal file
28
apilibs/kexbases/shell32/IsUserAnAdmin.c
Normal file
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2007, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
/* MAKE_EXPORT IsUserAnAdmin_new=IsUserAnAdmin */
|
||||
BOOL WINAPI IsUserAnAdmin_new(void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
49
apilibs/kexbases/shell32/_shell32_apilist.c
Normal file
49
apilibs/kexbases/shell32/_shell32_apilist.c
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_shell32_apilist.h"
|
||||
|
||||
BOOL init_shell32()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const apilib_named_api shell32_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("CommandLineToArgvW", CommandLineToArgvW_new),
|
||||
DECL_API("IsUserAnAdmin", IsUserAnAdmin_new),
|
||||
DECL_API("SHCreateShellItem", SHCreateShellItem_stub),
|
||||
DECL_API("SHParseDisplayName", SHParseDisplayName_stub),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api shell32_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_shell32 = DECL_TAB("SHELL32.DLL", shell32_named_apis, 0 /*shell32_ordinal_apis*/);
|
38
apilibs/kexbases/shell32/_shell32_apilist.h
Normal file
38
apilibs/kexbases/shell32/_shell32_apilist.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _SHELL32_APILIST_H
|
||||
#define _SHELL32_APILIST_H
|
||||
|
||||
#include "auxdecl.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_shell32();
|
||||
extern const apilib_api_table apitable_shell32;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
LPWSTR* WINAPI CommandLineToArgvW_new(LPCWSTR lpCmdline, int* numargs);
|
||||
BOOL WINAPI IsUserAnAdmin_new(void);
|
||||
STUB SHParseDisplayName_stub;
|
||||
STUB SHCreateShellItem_stub;
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
25
apilibs/kexbases/shell32/_shell32_stubs.c
Normal file
25
apilibs/kexbases/shell32/_shell32_stubs.c
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2009, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
UNIMPL_FUNC(SHParseDisplayName, 5);
|
||||
UNIMPL_FUNC(SHCreateShellItem, 4);
|
51
apilibs/kexbases/version/_version_apilist.c
Normal file
51
apilibs/kexbases/version/_version_apilist.c
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "kexcoresdk.h"
|
||||
#include "_version_apilist.h"
|
||||
|
||||
BOOL init_version()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const apilib_named_api version_named_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS BEGIN ***/
|
||||
DECL_API("GetFileVersionInfoSizeW", GetFileVersionInfoSizeW_new),
|
||||
DECL_API("GetFileVersionInfoW", GetFileVersionInfoW_new),
|
||||
DECL_API("VerFindFileW", VerFindFileW_new),
|
||||
DECL_API("VerInstallFileW", VerInstallFileW_new),
|
||||
DECL_API("VerLanguageNameW", VerLanguageNameW_new),
|
||||
DECL_API("VerQueryValueW", VerQueryValueW_new),
|
||||
/*** AUTOGENERATED APILIST NAMED EXPORTS END ***/
|
||||
};
|
||||
|
||||
#if 0
|
||||
static const apilib_unnamed_api version_ordinal_apis[] =
|
||||
{
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS BEGIN ***/
|
||||
/*** AUTOGENERATED APILIST ORDINAL EXPORTS END ***/
|
||||
};
|
||||
#endif
|
||||
|
||||
const apilib_api_table apitable_version = DECL_TAB("VERSION.DLL", version_named_apis, 0 /*version_ordinal_apis*/);
|
40
apilibs/kexbases/version/_version_apilist.h
Normal file
40
apilibs/kexbases/version/_version_apilist.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _VERSION_APILIST_H
|
||||
#define _VERSION_APILIST_H
|
||||
|
||||
#include "auxdecl.h"
|
||||
#include "kexcoresdk.h"
|
||||
|
||||
BOOL init_version();
|
||||
extern const apilib_api_table apitable_version;
|
||||
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS BEGIN ***/
|
||||
DWORD WINAPI GetFileVersionInfoSizeW_new(LPWSTR filenameW, LPDWORD handle);
|
||||
BOOL WINAPI GetFileVersionInfoW_new(LPWSTR filenameW, DWORD handle, DWORD len, LPVOID data);
|
||||
DWORD WINAPI VerFindFileW_new(DWORD dwFlags, LPWSTR szFileNameW, LPWSTR szWinDirW, LPWSTR szAppDirW, LPWSTR szCurDirW, PUINT lpuCurDirLenW, LPWSTR szDestDirW, PUINT lpuDestDirLenW);
|
||||
DWORD WINAPI VerInstallFileW_new(DWORD uFlags, LPWSTR szSrcFileNameW, LPWSTR szDestFileNameW, LPWSTR szSrcDirW, LPWSTR szDestDirW, LPWSTR szCurDirW, LPWSTR szTmpFileW, PUINT lpuTmpFileLenW);
|
||||
DWORD WINAPI VerLanguageNameW_new(DWORD wLang, LPWSTR szLangW, DWORD nSize);
|
||||
BOOL WINAPI VerQueryValueW_new(const LPVOID pBlock, LPWSTR lpSubBlockW, LPVOID *lplpBuffer, PUINT puLen);
|
||||
/*** AUTOGENERATED APILIST DECLARATIONS END ***/
|
||||
|
||||
#endif
|
161
apilibs/kexbases/version/universion.c
Normal file
161
apilibs/kexbases/version/universion.c
Normal file
@ -0,0 +1,161 @@
|
||||
/*
|
||||
* KernelEx
|
||||
* Copyright (C) 2008, Xeno86
|
||||
*
|
||||
* This file is part of KernelEx source code.
|
||||
*
|
||||
* KernelEx is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published
|
||||
* by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* KernelEx 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
static const char signature[] = "KxRC";
|
||||
|
||||
/* MAKE_EXPORT GetFileVersionInfoSizeW_new=GetFileVersionInfoSizeW */
|
||||
DWORD WINAPI GetFileVersionInfoSizeW_new(LPWSTR filenameW, LPDWORD handle)
|
||||
{
|
||||
DWORD size;
|
||||
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(filename);
|
||||
size = GetFileVersionInfoSizeA(filenameA, handle);
|
||||
return size * (1 + sizeof(WCHAR)) + 4;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT GetFileVersionInfoW_new=GetFileVersionInfoW */
|
||||
BOOL WINAPI GetFileVersionInfoW_new(LPWSTR filenameW, DWORD handle, DWORD len, LPVOID data)
|
||||
{
|
||||
DWORD ret;
|
||||
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(filename);
|
||||
ret = GetFileVersionInfoA(filenameA, handle, len, data);
|
||||
if (ret)
|
||||
{
|
||||
if (len < (DWORD)(*(WORD*)data * (1 + sizeof(WCHAR)) + 4))
|
||||
{
|
||||
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
memcpy(((char*)data) + *(WORD*)data, signature, 4);
|
||||
memset(((char*)data) + *(WORD*)data + 4, 0, *(WORD*)data * sizeof(WCHAR));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerFindFileW_new=VerFindFileW */
|
||||
DWORD WINAPI VerFindFileW_new(DWORD dwFlags, LPWSTR szFileNameW, LPWSTR szWinDirW, LPWSTR szAppDirW, LPWSTR szCurDirW, PUINT lpuCurDirLenW, LPWSTR szDestDirW, PUINT lpuDestDirLenW)
|
||||
{
|
||||
DWORD ret;
|
||||
DWORD last_error = GetLastError();
|
||||
DWORD result;
|
||||
UINT CurDirLenA = MAX_PATH;
|
||||
UINT DestDirLenA = MAX_PATH;
|
||||
char szCurDirA[MAX_PATH];
|
||||
char szDestDirA[MAX_PATH];
|
||||
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(szFileName);
|
||||
file_ALLOC_WtoA(szWinDir);
|
||||
file_ALLOC_WtoA(szAppDir);
|
||||
|
||||
*szCurDirA = '\0';
|
||||
*szDestDirA = '\0';
|
||||
|
||||
ret = VerFindFileA(dwFlags, szFileNameA, szWinDirA, szAppDirA, szCurDirA, &CurDirLenA, szDestDirA, &DestDirLenA);
|
||||
|
||||
result = file_AtoW(szCurDir, *lpuCurDirLenW);
|
||||
if (!result)
|
||||
{
|
||||
szCurDirW[*lpuCurDirLenW - 1] = 0;
|
||||
result = file_AtoW(szCurDir, 0);
|
||||
ret |= VFF_BUFFTOOSMALL;
|
||||
}
|
||||
*lpuCurDirLenW = result;
|
||||
result = file_AtoW(szDestDir, *lpuDestDirLenW);
|
||||
if (!result)
|
||||
{
|
||||
szDestDirW[*lpuDestDirLenW - 1] = 0;
|
||||
result = file_AtoW(szDestDir, 0);
|
||||
ret |= VFF_BUFFTOOSMALL;
|
||||
}
|
||||
*lpuDestDirLenW = result;
|
||||
|
||||
SetLastError(last_error);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerInstallFileW_new=VerInstallFileW */
|
||||
DWORD WINAPI VerInstallFileW_new(DWORD uFlags, LPWSTR szSrcFileNameW, LPWSTR szDestFileNameW, LPWSTR szSrcDirW, LPWSTR szDestDirW, LPWSTR szCurDirW, LPWSTR szTmpFileW, PUINT lpuTmpFileLenW)
|
||||
{
|
||||
DWORD ret;
|
||||
DWORD last_error = GetLastError();
|
||||
DWORD result;
|
||||
UINT TmpFileLenA = MAX_PATH;
|
||||
char szTmpFileA[MAX_PATH];
|
||||
|
||||
file_GetCP();
|
||||
file_ALLOC_WtoA(szSrcFileName);
|
||||
file_ALLOC_WtoA(szDestFileName);
|
||||
file_ALLOC_WtoA(szSrcDir);
|
||||
file_ALLOC_WtoA(szDestDir);
|
||||
file_ALLOC_WtoA(szCurDir);
|
||||
|
||||
*szTmpFileA = '\0';
|
||||
|
||||
ret = VerInstallFileA(uFlags, szSrcFileNameA, szDestFileNameA, szSrcDirA, szDestDirA, szCurDirA, szTmpFileA, &TmpFileLenA);
|
||||
|
||||
result = file_AtoW(szTmpFile, *lpuTmpFileLenW);
|
||||
if (!result)
|
||||
{
|
||||
szTmpFileW[*lpuTmpFileLenW - 1] = 0;
|
||||
result = file_AtoW(szTmpFile, 0);
|
||||
ret |= VIF_BUFFTOOSMALL;
|
||||
}
|
||||
*lpuTmpFileLenW = result;
|
||||
|
||||
SetLastError(last_error);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* MAKE_EXPORT VerLanguageNameW_new=VerLanguageNameW */
|
||||
DWORD WINAPI VerLanguageNameW_new(DWORD wLang, LPWSTR szLangW, DWORD nSize); /* -> implementation is in kernel32 folder */
|
||||
|
||||
/* MAKE_EXPORT VerQueryValueW_new=VerQueryValueW */
|
||||
BOOL WINAPI VerQueryValueW_new(const LPVOID pBlock, LPWSTR lpSubBlockW, LPVOID *lplpBuffer, PUINT puLen)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
if (!pBlock || memcmp((char*)pBlock + *(WORD*)pBlock, signature, 4))
|
||||
return FALSE;
|
||||
|
||||
ALLOC_WtoA(lpSubBlock);
|
||||
ret = VerQueryValueA(pBlock, lpSubBlockA, lplpBuffer, puLen);
|
||||
if (ret && strcmpi(lpSubBlockA, "\\") && strcmpi(lpSubBlockA, "\\VarFileInfo\\Translation"))
|
||||
{
|
||||
WCHAR* lpBlockW = (WCHAR*)((char*)pBlock + *(WORD*)pBlock + 4);
|
||||
DWORD pos = (char*)*lplpBuffer - (char*)pBlock;
|
||||
WCHAR* p = lpBlockW + pos;
|
||||
UINT len = 0;
|
||||
if (!*p)
|
||||
len = MultiByteToWideChar(CP_ACP, 0, (char*)*lplpBuffer, -1, p, *(WORD*)pBlock - pos);
|
||||
else
|
||||
do len++; while (*p++);
|
||||
*lplpBuffer = lpBlockW + pos;
|
||||
*puLen = len;
|
||||
}
|
||||
return ret;
|
||||
}
|
Reference in New Issue
Block a user