⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 winbase.h

📁 此程序为EVC编写的MIS系统
💻 H
📖 第 1 页 / 共 5 页
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//

/*++


Module Name: winbase.h

Purpose:This header file declares the Base APIs.

--*/

#ifndef __WINBASE_H__
#define __WINBASE_H__
#define _WINBASE_

//
// Define API decoration for direct importing of DLL references.
//

#if defined (_M_CEE)
#	if defined(_ADVAPI32_) || defined(COREDLL)
#		pragma message (__FILE__ ": CEF not supported for building COREDLL contents")
#	endif
#endif	// _M_CEE UNDER_CE

#if !defined(_ADVAPI32_)
#define WINADVAPI  DECLSPEC_IMPORT
#else
#define WINADVAPI
#endif

#if !defined(COREDLL)
#define WINBASEAPI DECLSPEC_IMPORT
#else
#define WINBASEAPI
#endif

#ifdef __cplusplus
extern "C" {
#endif

#include <windef.h>

#define VS_FILE_INFO				RT_VERSION
#define VS_VERSION_INFO				1
#define VS_USER_DEFINED				100

#define VS_FFI_SIGNATURE			0xFEEF04BDL
#define VS_FFI_STRUCVERSION			0x00010000L
#define VS_FFI_FILEFLAGSMASK		0x0000003FL

#define VS_FF_DEBUG					0x00000001L
#define VS_FF_PRERELEASE			0x00000002L
#define VS_FF_PATCHED				0x00000004L
#define VS_FF_PRIVATEBUILD			0x00000008L
#define VS_FF_INFOINFERRED			0x00000010L
#define VS_FF_SPECIALBUILD			0x00000020L

#define VOS_UNKNOWN					0x00000000L
#define VOS_DOS						0x00010000L
#define VOS_OS216					0x00020000L
#define VOS_OS232					0x00030000L
#define VOS_NT						0x00040000L
#define VOS_WINDOWSCE               0x00050000L
#define VOS__BASE					0x00000000L
#define VOS__WINDOWS16				0x00000001L
#define VOS__PM16					0x00000002L
#define VOS__PM32					0x00000003L
#define VOS__WINDOWS32				0x00000004L
#define VOS_DOS_WINDOWS16			0x00010001L
#define VOS_DOS_WINDOWS32			0x00010004L
#define VOS_OS216_PM16				0x00020002L
#define VOS_OS232_PM32				0x00030003L
#define VOS_NT_WINDOWS32			0x00040004L
#define VOS_CE_WINDOWS32            0x00050004L

#define VFT_UNKNOWN					0x00000000L
#define VFT_APP						0x00000001L
#define VFT_DLL						0x00000002L
#define VFT_DRV						0x00000003L
#define VFT_FONT					0x00000004L
#define VFT_VXD						0x00000005L
#define VFT_STATIC_LIB				0x00000007L

#define VFT2_UNKNOWN				0x00000000L
#define VFT2_DRV_PRINTER			0x00000001L
#define VFT2_DRV_KEYBOARD			0x00000002L
#define VFT2_DRV_LANGUAGE			0x00000003L
#define VFT2_DRV_DISPLAY			0x00000004L
#define VFT2_DRV_MOUSE				0x00000005L
#define VFT2_DRV_NETWORK			0x00000006L
#define VFT2_DRV_SYSTEM				0x00000007L
#define VFT2_DRV_INSTALLABLE		0x00000008L
#define VFT2_DRV_SOUND				0x00000009L
#define VFT2_DRV_COMM				0x0000000AL
#define VFT2_DRV_INPUTMETHOD		0x0000000BL

#define VFT2_FONT_RASTER			0x00000001L
#define VFT2_FONT_VECTOR			0x00000002L
#define VFT2_FONT_TRUETYPE			0x00000003L

#define VFFF_ISSHAREDFILE			0x0001

#define VFF_CURNEDEST				0x0001
#define VFF_FILEINUSE				0x0002
#define VFF_BUFFTOOSMALL			0x0004

#define VIFF_FORCEINSTALL			0x0001
#define VIFF_DONTDELETEOLD			0x0002

#define VIF_TEMPFILE				0x00000001L
#define VIF_MISMATCH				0x00000002L
#define VIF_SRCOLD					0x00000004L
#define VIF_DIFFLANG				0x00000008L
#define VIF_DIFFCODEPG				0x00000010L
#define VIF_DIFFTYPE				0x00000020L
#define VIF_WRITEPROT				0x00000040L
#define VIF_FILEINUSE				0x00000080L
#define VIF_OUTOFSPACE				0x00000100L
#define VIF_ACCESSVIOLATION			0x00000200L
#define VIF_SHARINGVIOLATION		0x00000400L
#define VIF_CANNOTCREATE			0x00000800L
#define VIF_CANNOTDELETE			0x00001000L
#define VIF_CANNOTRENAME			0x00002000L
#define VIF_CANNOTDELETECUR			0x00004000L
#define VIF_OUTOFMEMORY				0x00008000L
#define VIF_CANNOTREADSRC			0x00010000L
#define VIF_CANNOTREADDST			0x00020000L
#define VIF_BUFFTOOSMALL			0x00040000L

#ifndef RC_INVOKED              /* RC doesn't need to see the rest of this */
typedef struct tagVS_FIXEDFILEINFO {
    DWORD   dwSignature;			/* e.g. 0xfeef04bd */
    DWORD   dwStrucVersion;			/* e.g. 0x00000042 = "0.42" */
    DWORD   dwFileVersionMS;		/* e.g. 0x00030075 = "3.75" */
    DWORD   dwFileVersionLS;		/* e.g. 0x00000031 = "0.31" */
    DWORD   dwProductVersionMS;		/* e.g. 0x00030010 = "3.10" */
    DWORD   dwProductVersionLS;		/* e.g. 0x00000031 = "0.31" */
    DWORD   dwFileFlagsMask;		/* = 0x3F for version "0.42" */
    DWORD   dwFileFlags;			/* e.g. VFF_DEBUG | VFF_PRERELEASE */
    DWORD   dwFileOS;				/* e.g. VOS_DOS_WINDOWS16 */
    DWORD   dwFileType;				/* e.g. VFT_DRIVER */
    DWORD   dwFileSubtype;			/* e.g. VFT2_DRV_KEYBOARD */
    DWORD   dwFileDateMS;			/* e.g. 0 */
    DWORD   dwFileDateLS;			/* e.g. 0 */
} VS_FIXEDFILEINFO;
#endif

#define INVALID_HANDLE_VALUE (HANDLE)-1
#define INVALID_FILE_SIZE (DWORD)0xFFFFFFFF
#define INVALID_SET_FILE_POINTER ((DWORD)-1)

#define FILE_BEGIN           0
#define FILE_CURRENT         1
#define FILE_END             2
//
//  File System time stamps are represented with the following structure:
//

typedef struct _FILETIME {
    DWORD dwLowDateTime;
    DWORD dwHighDateTime;
} FILETIME, *PFILETIME, *LPFILETIME;

typedef struct _SYSTEMTIME {
    WORD wYear;
    WORD wMonth;
    WORD wDayOfWeek;
    WORD wDay;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} SYSTEMTIME, *LPSYSTEMTIME;

#ifdef MIPS_R4000 /* or above */

#define InterlockedIncrement _InterlockedIncrement
#define InterlockedDecrement _InterlockedDecrement
#define InterlockedExchange _InterlockedExchange

LONG
WINAPI
InterlockedIncrement(
    LPLONG lpAddend
    );

LONG
WINAPI
InterlockedDecrement(
    LPLONG lpAddend
    );

LONG
WINAPI
InterlockedExchange(
    LPLONG Target,
    LONG Value
    );

#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
#pragma intrinsic(_InterlockedExchange)

#define InterlockedCompareExchange(ptr, newval, oldval) \
	((PVOID)InterlockedTestExchange((LPLONG)ptr, (LONG)oldval, (LONG)newval))


#elif (defined(PPC) && _MSC_VER >= 1000) && !defined(RC_INVOKED)

#define InterlockedIncrement _InterlockedIncrement
#define InterlockedDecrement _InterlockedDecrement
#define InterlockedExchange _InterlockedExchange
#define InterlockedExchangeAdd _InterlockedExchangeAdd

LONG
WINAPI
InterlockedIncrement(
    LPLONG lpAddend
    );

LONG
WINAPI
InterlockedDecrement(
    LPLONG lpAddend
    );

LONG
WINAPI
InterlockedExchange(
    LPLONG Target,
    LONG Value
    );

#define InterlockedExchangePointer(Target, Value) \
    ((PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value)))

#define InterlockedCompareExchange(Destination, ExChange, Comperand) \
    ((LONG)_InterlockedCompareExchange((PVOID *)(Destination), (PVOID)(ExChange), (PVOID)(Comperand)))

#define InterlockedCompareExchangePointer(Destination, ExChange, Comperand) \
    _InterlockedCompareExchange((Destination) (ExChange), (Comperand))

PVOID
_InterlockedCompareExchange(
    PVOID *Destination,
    PVOID Exchange,
    PVOID Comperand
    );

LONG
WINAPI
InterlockedExchangeAdd(
    LPLONG Addend,
    LONG Value
    );

#define InterlockedTestExchange(Target, oldValue, newValue) \
    InterlockedCompareExchange((Target), (newValue), (oldValue))

#pragma intrinsic(_InterlockedIncrement)
#pragma intrinsic(_InterlockedDecrement)
#pragma intrinsic(_InterlockedExchange)
#pragma intrinsic(_InterlockedCompareExchange)
#pragma intrinsic(_InterlockedExchangeAdd)

#elif defined(x86)

#pragma warning(disable:4035)               // re-enable below

  __inline
  LONG
  WINAPI
  InterlockedIncrement(
      IN PLONG Addend
      )
  {
      __asm {
          mov     eax, 1
          mov     ecx, Addend
          xadd    [ecx], eax
          inc     eax
      }
  }

  __inline
  LONG
  WINAPI
  InterlockedDecrement(
      IN PLONG Addend
      )
  {
      __asm {
          mov     eax, -1
          mov     ecx, Addend
          xadd    [ecx], eax
          dec     eax
      }
  }

  __inline
  LONG
  WINAPI
  InterlockedExchange(
      IN OUT PLONG Target,
      IN LONG Value
      )
  {
      __asm {
          mov     eax, Value
          mov     ecx, Target
          xchg 	[ecx], eax
      }
  }


#define InterlockedExchangePointer(Target, Value) \
    ((PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value)))

  __inline
  LONG
  WINAPI
  InterlockedTestExchange(
  	LPLONG Target,
  	LONG oldValue,
  	LONG newValue
  	)
  {
      __asm {
          mov     eax, oldValue
          mov     ecx, Target
          mov     edx, newValue
          cmpxchg [ecx], edx
      }
  }

  __inline
  LONG
  WINAPI
  InterlockedCompareExchange(
  	LPLONG Target,
    LONG Exchange,
    LONG Comperand
  	)
  {
      __asm {
          mov     eax, Comperand
          mov     ecx, Target
          mov     edx, Exchange
          cmpxchg [ecx], edx
      }
  }

#define InterlockedCompareExchangePointer(Destination, ExChange, Comperand) \
    ((PVOID)InterlockedCompareExchange((PLONG)(Destination), (LONG)(ExChange), (LONG)(Comperand)))

  __inline
  LONG
  WINAPI
  InterlockedExchangeAdd(
      IN PLONG Addend,
      IN LONG  Value
      )
  {
      __asm {
          mov     ecx, Addend
          mov     eax, Value
          xadd    [ecx], eax
      }
  }

#pragma warning(default:4035)

#else

LONG
WINAPI
InterlockedIncrement(
    LPLONG lpAddend
    );


LONG
WINAPI
InterlockedDecrement(
    LPLONG lpAddend
    );


LONG
WINAPI
InterlockedExchange(
    LPLONG Target,
    LONG Value
    );

#define InterlockedExchangePointer(Target, Value) \
    ((PVOID)InterlockedExchange((PLONG)(Target), (LONG)(Value)))

LONG
WINAPI
InterlockedCompareExchange(
    IN OUT LPLONG Destination,
    LONG Exchange,
    LONG Comperand
    );

#define InterlockedCompareExchangePointer(Destination, ExChange, Comperand) \
    ((PVOID)InterlockedCompareExchange((PLONG)(Destination), (LONG)(ExChange), (LONG)(Comperand)))

LONG
WINAPI
InterlockedExchangeAdd(
    LPLONG Addend,
    LONG Value
    );


#define InterlockedTestExchange(Target, oldValue, newValue) \
    InterlockedCompareExchange((Target), (newValue), (oldValue))

#endif

#define MAXINTATOM 0xC000
#define MAKEINTATOM(i)  (LPTSTR)((DWORD)((WORD)(i)))
#define INVALID_ATOM ((ATOM)0)

DWORD
WINAPI
Random();

int
WINAPI
WinMain(
    HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
#ifdef UNDER_CE
    LPWSTR lpCmdLine,
#else
    LPSTR lpCmdLine,
#endif
    int nShowCmd
    );

LONG WINAPI CompareFileTime(const FILETIME *lpft1, const FILETIME *lpft2);
BOOL WINAPI FileTimeToSystemTime(const FILETIME *lpft, LPSYSTEMTIME lpst);
BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME *lpst, LPFILETIME lpft);
BOOL WINAPI FileTimeToLocalFileTime(const FILETIME *lpft, LPFILETIME lpftLocal);
BOOL WINAPI LocalFileTimeToFileTime(const FILETIME *lpftLocal, LPFILETIME lpft);

// Internal API for the file system
VOID GetCurrentFT(LPFILETIME lpFileTime);

/* Derived from process.h file from Windows NT */
BOOL
WINAPI
DllMain (
    HANDLE hinstDLL,
    DWORD dwReason,
    LPVOID lpvReserved
    );

#ifdef UNDER_CE
#define GetProcAddress GetProcAddressW

WINBASEAPI
FARPROC
WINAPI
GetProcAddressW(
    HMODULE hModule,
    LPCWSTR lpProcName
    );

WINBASEAPI
FARPROC
WINAPI
GetProcAddressA(
    HMODULE hModule,
    LPCSTR lpProcName
    );

#else

WINBASEAPI
FARPROC
WINAPI
GetProcAddress(
    HMODULE hModule,
    LPCSTR lpProcName
    );

#endif

VOID
WINAPI
GetLocalTime (
    LPSYSTEMTIME lpSystemTime
    );

VOID
WINAPI
GetSystemTime (
    LPSYSTEMTIME lpSystemTime
    );

typedef struct _TIME_ZONE_INFORMATION {
    LONG Bias;
    WCHAR StandardName[ 32 ];
    SYSTEMTIME StandardDate;
    LONG StandardBias;
    WCHAR DaylightName[ 32 ];
    SYSTEMTIME DaylightDate;
    LONG DaylightBias;
} TIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;

DWORD
WINAPI
GetTimeZoneInformation (
    LPTIME_ZONE_INFORMATION lpTimeZoneInformation
    );

BOOL
WINAPI
SetLocalTime (
    CONST SYSTEMTIME *lpSystemTime
    );

BOOL
WINAPI
SetSystemTime (
    CONST SYSTEMTIME *lpSystemTime
    );

void
WINAPI
SetDaylightTime (
	DWORD dst
	);

BOOL
WINAPI
SetTimeZoneInformation (
    CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation
    );

/*
	@doc BOTH EXTERNAL
	
	@func LPTSTR | lstrcat| Appends one string to another.
    @parm LPTSTR | lpszString1 | address of buffer for concatenated strings
    @parm LPTSTR | lpszString2 | address of string to add to string1

	@comm Follows the Win32 reference description with these restrictions:
	@comm Supports only the Unicode version of this function.

*/
WINBASEAPI
LPSTR
WINAPI
lstrcatA(
    LPSTR lpString1,
    LPCSTR lpString2
    );

#define lstrcatW wcscat
#ifdef UNICODE
#define lstrcat lstrcatW
#else
#define lstrcat lstrcatA
#endif

/*
	@doc BOTH EXTERNAL
	
	@func int | lstrcmp| Compares two character strings. The comparison is case sensitive.
    @parm LPTSTR | lpszString1 | address of first string
    @parm LPTSTR | lpszString2 | address of second string

	@comm Follows the Win32 reference description with these restrictions:
	@comm Supports only the Unicode version of this function.

*/

WINBASEAPI
int
WINAPI
lstrcmpA(
    LPCSTR lpString1,
    LPCSTR lpString2
    );
WINBASEAPI
int
WINAPI
lstrcmpW(
    LPCWSTR lpString1,
    LPCWSTR lpString2
    );
#ifdef UNICODE
#define lstrcmp  lstrcmpW
#else
#define lstrcmp  lstrcmpA
#endif // !UNICODE

/*
	@doc BOTH EXTERNAL
	
	@func int | lstrcmpi| Compares two character strings. The comparison is
	not case sensitive.
    @parm LPTSTR | lpszString1 | address of first string
    @parm LPTSTR | lpszString2 | address of second string

	@comm Follows the Win32 reference description with these restrictions:
	@comm Supports only the Unicode version of this function.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -