Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS

Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
This commit is contained in:
Cyd
2026-06-24 21:28:16 -05:00
commit 2b8ca921cb
66341 changed files with 7923174 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,12 @@
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
///////////////////////////////////////
// No longer used
@@ -0,0 +1,365 @@
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
#ifndef __ATLCONV_H__
#define __ATLCONV_H__
#ifndef __cplusplus
#error ATL requires C++ compilation (use a .cpp suffix)
#endif
#include <atldef.h>
#ifndef _INC_MALLOC
#include <malloc.h>
#endif // _INC_MALLOC
#pragma pack(push,8)
#ifdef _CONVERSION_USES_THREAD_LOCALE
#ifndef _DEBUG
#define USES_CONVERSION int _convert; _convert; UINT _acp = GetACP(); _acp; LPCWSTR _lpw; _lpw; LPCSTR _lpa; _lpa
#else
#define USES_CONVERSION int _convert = 0; _convert; UINT _acp = GetACP(); _acp; LPCWSTR _lpw = NULL; _lpw; LPCSTR _lpa = NULL; _lpa
#endif
#else
#ifndef _DEBUG
#define USES_CONVERSION int _convert; _convert; UINT _acp = CP_ACP; _acp; LPCWSTR _lpw; _lpw; LPCSTR _lpa; _lpa
#else
#define USES_CONVERSION int _convert = 0; _convert; UINT _acp = CP_ACP; _acp; LPCWSTR _lpw = NULL; _lpw; LPCSTR _lpa = NULL; _lpa
#endif
#endif
#ifdef _WINGDI_
ATLAPI_(LPDEVMODEA) AtlDevModeW2A(LPDEVMODEA lpDevModeA, LPDEVMODEW lpDevModeW);
#endif
/////////////////////////////////////////////////////////////////////////////
// Global UNICODE<>ANSI translation helpers
inline LPWSTR WINAPI AtlA2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars, UINT acp)
{
ATLASSERT(lpa != NULL);
ATLASSERT(lpw != NULL);
// verify that no illegal character present
// since lpw was allocated based on the size of lpa
// don't worry about the number of chars
lpw[0] = '\0';
MultiByteToWideChar(acp, 0, lpa, -1, lpw, nChars);
return lpw;
}
inline LPSTR WINAPI AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp)
{
ATLASSERT(lpw != NULL);
ATLASSERT(lpa != NULL);
// verify that no illegal character present
// since lpa was allocated based on the size of lpw
// don't worry about the number of chars
lpa[0] = '\0';
WideCharToMultiByte(acp, 0, lpw, -1, lpa, nChars, NULL, NULL);
return lpa;
}
inline LPWSTR WINAPI AtlA2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars)
{
return AtlA2WHelper(lpw, lpa, nChars, CP_ACP);
}
inline LPSTR WINAPI AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars)
{
return AtlW2AHelper(lpa, lpw, nChars, CP_ACP);
}
#ifdef _CONVERSION_USES_THREAD_LOCALE
#ifdef ATLA2WHELPER
#undef ATLA2WHELPER
#undef ATLW2AHELPER
#endif
#define ATLA2WHELPER AtlA2WHelper
#define ATLW2AHELPER AtlW2AHelper
#else
#ifndef ATLA2WHELPER
#define ATLA2WHELPER AtlA2WHelper
#define ATLW2AHELPER AtlW2AHelper
#endif
#endif
#ifdef _CONVERSION_USES_THREAD_LOCALE
#define A2W(lpa) (\
((_lpa = lpa) == NULL) ? NULL : (\
_convert = (lstrlenA(_lpa)+1),\
ATLA2WHELPER((LPWSTR) alloca(_convert*2), _lpa, _convert, _acp)))
#else
#define A2W(lpa) (\
((_lpa = lpa) == NULL) ? NULL : (\
_convert = (lstrlenA(_lpa)+1),\
ATLA2WHELPER((LPWSTR) alloca(_convert*2), _lpa, _convert)))
#endif
#ifdef _CONVERSION_USES_THREAD_LOCALE
#define W2A(lpw) (\
((_lpw = lpw) == NULL) ? NULL : (\
_convert = (lstrlenW(_lpw)+1)*2,\
ATLW2AHELPER((LPSTR) alloca(_convert), _lpw, _convert, _acp)))
#else
#define W2A(lpw) (\
((_lpw = lpw) == NULL) ? NULL : (\
_convert = (lstrlenW(_lpw)+1)*2,\
ATLW2AHELPER((LPSTR) alloca(_convert), _lpw, _convert)))
#endif
#define A2CW(lpa) ((LPCWSTR)A2W(lpa))
#define W2CA(lpw) ((LPCSTR)W2A(lpw))
#if defined(_UNICODE)
// in these cases the default (TCHAR) is the same as OLECHAR
inline size_t ocslen(LPCOLESTR x) { return lstrlenW(x); }
inline OLECHAR* ocscpy(LPOLESTR dest, LPCOLESTR src) { return lstrcpyW(dest, src); }
inline OLECHAR* ocscat(LPOLESTR dest, LPCOLESTR src) { return lstrcatW(dest, src); }
inline LPCOLESTR T2COLE(LPCTSTR lp) { return lp; }
inline LPCTSTR OLE2CT(LPCOLESTR lp) { return lp; }
inline LPOLESTR T2OLE(LPTSTR lp) { return lp; }
inline LPTSTR OLE2T(LPOLESTR lp) { return lp; }
inline LPOLESTR CharNextO(LPCOLESTR lp) {return CharNextW(lp);}
#elif defined(OLE2ANSI)
// in these cases the default (TCHAR) is the same as OLECHAR
inline size_t ocslen(LPCOLESTR x) { return lstrlen(x); }
inline OLECHAR* ocscpy(LPOLESTR dest, LPCOLESTR src) { return lstrcpy(dest, src); }
inline OLECHAR* ocscat(LPOLESTR dest, LPCOLESTR src) { return ocscpy(dest+ocslen(dest), src); }
inline LPCOLESTR T2COLE(LPCTSTR lp) { return lp; }
inline LPCTSTR OLE2CT(LPCOLESTR lp) { return lp; }
inline LPOLESTR T2OLE(LPTSTR lp) { return lp; }
inline LPTSTR OLE2T(LPOLESTR lp) { return lp; }
inline LPOLESTR CharNextO(LPCOLESTR lp) {return CharNext(lp);}
#else
inline size_t ocslen(LPCOLESTR x) { return lstrlenW(x); }
//lstrcpyW doesn't work on Win95, so we do this
inline OLECHAR* ocscpy(LPOLESTR dest, LPCOLESTR src)
{return (LPOLESTR) memcpy(dest, src, (lstrlenW(src)+1)*sizeof(WCHAR));}
inline OLECHAR* ocscat(LPOLESTR dest, LPCOLESTR src) { return ocscpy(dest+ocslen(dest), src); }
//CharNextW doesn't work on Win95 so we use this
#define T2COLE(lpa) A2CW(lpa)
#define T2OLE(lpa) A2W(lpa)
#define OLE2CT(lpo) W2CA(lpo)
#define OLE2T(lpo) W2A(lpo)
inline LPOLESTR CharNextO(LPCOLESTR lp) {return (LPOLESTR) ((*lp) ? (lp+1) : lp);}
#endif
#ifdef OLE2ANSI
inline LPOLESTR A2OLE(LPSTR lp) { return lp;}
inline LPSTR OLE2A(LPOLESTR lp) { return lp;}
#define W2OLE W2A
#define OLE2W A2W
inline LPCOLESTR A2COLE(LPCSTR lp) { return lp;}
inline LPCSTR OLE2CA(LPCOLESTR lp) { return lp;}
#define W2COLE W2CA
#define OLE2CW A2CW
#else
inline LPOLESTR W2OLE(LPWSTR lp) { return lp; }
inline LPWSTR OLE2W(LPOLESTR lp) { return lp; }
#define A2OLE A2W
#define OLE2A W2A
inline LPCOLESTR W2COLE(LPCWSTR lp) { return lp; }
inline LPCWSTR OLE2CW(LPCOLESTR lp) { return lp; }
#define A2COLE A2CW
#define OLE2CA W2CA
#endif
#ifdef _UNICODE
#define T2A W2A
#define A2T A2W
inline LPWSTR T2W(LPTSTR lp) { return lp; }
inline LPTSTR W2T(LPWSTR lp) { return lp; }
#define T2CA W2CA
#define A2CT A2CW
inline LPCWSTR T2CW(LPCTSTR lp) { return lp; }
inline LPCTSTR W2CT(LPCWSTR lp) { return lp; }
#else
#define T2W A2W
#define W2T W2A
inline LPSTR T2A(LPTSTR lp) { return lp; }
inline LPTSTR A2T(LPSTR lp) { return lp; }
#define T2CW A2CW
#define W2CT W2CA
inline LPCSTR T2CA(LPCTSTR lp) { return lp; }
inline LPCTSTR A2CT(LPCSTR lp) { return lp; }
#endif
inline BSTR A2WBSTR(LPCSTR lp, int nLen = -1)
{
USES_CONVERSION;
BSTR str = NULL;
int nConvertedLen = MultiByteToWideChar(_acp, 0, lp,
nLen, NULL, NULL)-1;
str = ::SysAllocStringLen(NULL, nConvertedLen);
if (str != NULL)
{
MultiByteToWideChar(_acp, 0, lp, -1,
str, nConvertedLen);
}
return str;
}
inline BSTR OLE2BSTR(LPCOLESTR lp) {return ::SysAllocString(lp);}
#if defined(_UNICODE)
// in these cases the default (TCHAR) is the same as OLECHAR
inline BSTR T2BSTR(LPCTSTR lp) {return ::SysAllocString(lp);}
inline BSTR A2BSTR(LPCSTR lp) {USES_CONVERSION; return A2WBSTR(lp);}
inline BSTR W2BSTR(LPCWSTR lp) {return ::SysAllocString(lp);}
#elif defined(OLE2ANSI)
// in these cases the default (TCHAR) is the same as OLECHAR
inline BSTR T2BSTR(LPCTSTR lp) {return ::SysAllocString(lp);}
inline BSTR A2BSTR(LPCSTR lp) {return ::SysAllocString(lp);}
inline BSTR W2BSTR(LPCWSTR lp) {USES_CONVERSION; return ::SysAllocString(W2COLE(lp));}
#else
inline BSTR T2BSTR(LPCTSTR lp) {USES_CONVERSION; return A2WBSTR(lp);}
inline BSTR A2BSTR(LPCSTR lp) {USES_CONVERSION; return A2WBSTR(lp);}
inline BSTR W2BSTR(LPCWSTR lp) {return ::SysAllocString(lp);}
#endif
#ifdef _WINGDI_
/////////////////////////////////////////////////////////////////////////////
// Global UNICODE<>ANSI translation helpers
inline LPDEVMODEW AtlDevModeA2W(LPDEVMODEW lpDevModeW, LPDEVMODEA lpDevModeA)
{
USES_CONVERSION;
if (lpDevModeA == NULL)
return NULL;
ATLASSERT(lpDevModeW != NULL);
AtlA2WHelper(lpDevModeW->dmDeviceName, (LPCSTR)lpDevModeA->dmDeviceName, 32*sizeof(WCHAR), _acp);
memcpy(&lpDevModeW->dmSpecVersion, &lpDevModeA->dmSpecVersion,
offsetof(DEVMODEW, dmFormName) - offsetof(DEVMODEW, dmSpecVersion));
AtlA2WHelper(lpDevModeW->dmFormName, (LPCSTR)lpDevModeA->dmFormName, 32*sizeof(WCHAR), _acp);
memcpy(&lpDevModeW->dmLogPixels, &lpDevModeA->dmLogPixels,
sizeof(DEVMODEW) - offsetof(DEVMODEW, dmLogPixels));
if (lpDevModeA->dmDriverExtra != 0)
memcpy(lpDevModeW+1, lpDevModeA+1, lpDevModeA->dmDriverExtra);
lpDevModeW->dmSize = sizeof(DEVMODEW);
return lpDevModeW;
}
inline LPTEXTMETRICW AtlTextMetricA2W(LPTEXTMETRICW lptmW, LPTEXTMETRICA lptmA)
{
USES_CONVERSION;
if (lptmA == NULL)
return NULL;
ATLASSERT(lptmW != NULL);
memcpy(lptmW, lptmA, sizeof(LONG) * 11);
memcpy(&lptmW->tmItalic, &lptmA->tmItalic, sizeof(BYTE) * 5);
MultiByteToWideChar(_acp, 0, (LPCSTR)&lptmA->tmFirstChar, 1, &lptmW->tmFirstChar, 1);
MultiByteToWideChar(_acp, 0, (LPCSTR)&lptmA->tmLastChar, 1, &lptmW->tmLastChar, 1);
MultiByteToWideChar(_acp, 0, (LPCSTR)&lptmA->tmDefaultChar, 1, &lptmW->tmDefaultChar, 1);
MultiByteToWideChar(_acp, 0, (LPCSTR)&lptmA->tmBreakChar, 1, &lptmW->tmBreakChar, 1);
return lptmW;
}
inline LPTEXTMETRICA AtlTextMetricW2A(LPTEXTMETRICA lptmA, LPTEXTMETRICW lptmW)
{
USES_CONVERSION;
if (lptmW == NULL)
return NULL;
ATLASSERT(lptmA != NULL);
memcpy(lptmA, lptmW, sizeof(LONG) * 11);
memcpy(&lptmA->tmItalic, &lptmW->tmItalic, sizeof(BYTE) * 5);
WideCharToMultiByte(_acp, 0, &lptmW->tmFirstChar, 1, (LPSTR)&lptmA->tmFirstChar, 1, NULL, NULL);
WideCharToMultiByte(_acp, 0, &lptmW->tmLastChar, 1, (LPSTR)&lptmA->tmLastChar, 1, NULL, NULL);
WideCharToMultiByte(_acp, 0, &lptmW->tmDefaultChar, 1, (LPSTR)&lptmA->tmDefaultChar, 1, NULL, NULL);
WideCharToMultiByte(_acp, 0, &lptmW->tmBreakChar, 1, (LPSTR)&lptmA->tmBreakChar, 1, NULL, NULL);
return lptmA;
}
#ifndef ATLDEVMODEA2W
#define ATLDEVMODEA2W AtlDevModeA2W
#define ATLDEVMODEW2A AtlDevModeW2A
#define ATLTEXTMETRICA2W AtlTextMetricA2W
#define ATLTEXTMETRICW2A AtlTextMetricW2A
#endif
#define DEVMODEW2A(lpw)\
((lpw == NULL) ? NULL : ATLDEVMODEW2A((LPDEVMODEA)alloca(sizeof(DEVMODEA)+lpw->dmDriverExtra), lpw))
#define DEVMODEA2W(lpa)\
((lpa == NULL) ? NULL : ATLDEVMODEA2W((LPDEVMODEW)alloca(sizeof(DEVMODEW)+lpa->dmDriverExtra), lpa))
#define TEXTMETRICW2A(lptmw)\
((lptmw == NULL) ? NULL : ATLTEXTMETRICW2A((LPTEXTMETRICA)alloca(sizeof(TEXTMETRICA)), lptmw))
#define TEXTMETRICA2W(lptma)\
((lptma == NULL) ? NULL : ATLTEXTMETRICA2W((LPTEXTMETRICW)alloca(sizeof(TEXTMETRICW)), lptma))
#ifdef OLE2ANSI
#define DEVMODEOLE DEVMODEA
#define LPDEVMODEOLE LPDEVMODEA
#define TEXTMETRICOLE TEXTMETRICA
#define LPTEXTMETRICOLE LPTEXTMETRICA
#else
#define DEVMODEOLE DEVMODEW
#define LPDEVMODEOLE LPDEVMODEW
#define TEXTMETRICOLE TEXTMETRICW
#define LPTEXTMETRICOLE LPTEXTMETRICW
#endif
#if defined(_UNICODE)
// in these cases the default (TCHAR) is the same as OLECHAR
inline LPDEVMODEW DEVMODEOLE2T(LPDEVMODEOLE lp) { return lp; }
inline LPDEVMODEOLE DEVMODET2OLE(LPDEVMODEW lp) { return lp; }
inline LPTEXTMETRICW TEXTMETRICOLE2T(LPTEXTMETRICOLE lp) { return lp; }
inline LPTEXTMETRICOLE TEXTMETRICT2OLE(LPTEXTMETRICW lp) { return lp; }
#elif defined(OLE2ANSI)
// in these cases the default (TCHAR) is the same as OLECHAR
inline LPDEVMODE DEVMODEOLE2T(LPDEVMODEOLE lp) { return lp; }
inline LPDEVMODEOLE DEVMODET2OLE(LPDEVMODE lp) { return lp; }
inline LPTEXTMETRIC TEXTMETRICOLE2T(LPTEXTMETRICOLE lp) { return lp; }
inline LPTEXTMETRICOLE TEXTMETRICT2OLE(LPTEXTMETRIC lp) { return lp; }
#else
#define DEVMODEOLE2T(lpo) DEVMODEW2A(lpo)
#define DEVMODET2OLE(lpa) DEVMODEA2W(lpa)
#define TEXTMETRICOLE2T(lptmw) TEXTMETRICW2A(lptmw)
#define TEXTMETRICT2OLE(lptma) TEXTMETRICA2W(lptma)
#endif
#endif //_WINGDI_
#pragma pack(pop)
#ifndef _ATL_DLL_IMPL
#ifndef _ATL_DLL
#define _ATLCONV_IMPL
#endif
#endif
#endif // __ATLCONV_H__
/////////////////////////////////////////////////////////////////////////////
#ifdef _ATLCONV_IMPL
#ifdef _WINGDI_
ATLINLINE ATLAPI_(LPDEVMODEA) AtlDevModeW2A(LPDEVMODEA lpDevModeA, LPDEVMODEW lpDevModeW)
{
USES_CONVERSION;
if (lpDevModeW == NULL)
return NULL;
ATLASSERT(lpDevModeA != NULL);
AtlW2AHelper((LPSTR)lpDevModeA->dmDeviceName, lpDevModeW->dmDeviceName, 32*sizeof(char), _acp);
memcpy(&lpDevModeA->dmSpecVersion, &lpDevModeW->dmSpecVersion,
offsetof(DEVMODEA, dmFormName) - offsetof(DEVMODEA, dmSpecVersion));
AtlW2AHelper((LPSTR)lpDevModeA->dmFormName, lpDevModeW->dmFormName, 32*sizeof(char), _acp);
memcpy(&lpDevModeA->dmLogPixels, &lpDevModeW->dmLogPixels,
sizeof(DEVMODEA) - offsetof(DEVMODEA, dmLogPixels));
if (lpDevModeW->dmDriverExtra != 0)
memcpy(lpDevModeA+1, lpDevModeW+1, lpDevModeW->dmDriverExtra);
lpDevModeA->dmSize = sizeof(DEVMODEA);
return lpDevModeA;
}
#endif //_WINGDI
//Prevent pulling in second time
#undef _ATLCONV_IMPL
#endif // _ATLCONV_IMPL
@@ -0,0 +1,12 @@
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
///////////////////////////////////////
// No longer used
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,133 @@
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
#ifndef __ATLDEF_H__
#define __ATLDEF_H__
#ifndef __cplusplus
#error ATL requires C++ compilation (use a .cpp suffix)
#endif
#ifdef UNDER_CE
#error ATL not currently supported for CE
#endif
#ifdef _UNICODE
#ifndef UNICODE
#define UNICODE // UNICODE is used by Windows headers
#endif
#endif
#ifdef UNICODE
#ifndef _UNICODE
#define _UNICODE // _UNICODE is used by C-runtime/MFC headers
#endif
#endif
#ifdef _DEBUG
#ifndef DEBUG
#define DEBUG
#endif
#endif
#ifndef ATLASSERT
#define ATLASSERT(expr) _ASSERTE(expr)
#endif
///////////////////////////////////////////////////////////////////////////////
// __declspec(novtable) is used on a class declaration to prevent the vtable
// pointer from being initialized in the constructor and destructor for the
// class. This has many benefits because the linker can now eliminate the
// vtable and all the functions pointed to by the vtable. Also, the actual
// constructor and destructor code are now smaller.
///////////////////////////////////////////////////////////////////////////////
// This should only be used on a class that is not directly createable but is
// rather only used as a base class. Additionally, the constructor and
// destructor (if provided by the user) should not call anything that may cause
// a virtual function call to occur back on the object.
///////////////////////////////////////////////////////////////////////////////
// By default, the wizards will generate new ATL object classes with this
// attribute (through the ATL_NO_VTABLE macro). This is normally safe as long
// the restriction mentioned above is followed. It is always safe to remove
// this macro from your class, so if in doubt, remove it.
///////////////////////////////////////////////////////////////////////////////
#ifdef _ATL_DISABLE_NO_VTABLE
#define ATL_NO_VTABLE
#else
#define ATL_NO_VTABLE __declspec(novtable)
#endif
#ifdef _ATL_DEBUG_REFCOUNT
#ifndef _ATL_DEBUG_INTERFACES
#define _ATL_DEBUG_INTERFACES
#endif
#endif
#ifdef _ATL_DEBUG_INTERFACES
#ifndef _ATL_DEBUG
#define _ATL_DEBUG
#endif // _ATL_DEBUG
#endif // _ATL_DEBUG_INTERFACES
#ifndef _ATL_HEAPFLAGS
#ifdef _MALLOC_ZEROINIT
#define _ATL_HEAPFLAGS HEAP_ZERO_MEMORY
#else
#define _ATL_HEAPFLAGS 0
#endif
#endif
#ifndef _ATL_PACKING
#define _ATL_PACKING 8
#endif
#if defined(_ATL_DLL)
#define ATLAPI extern "C" HRESULT __declspec(dllimport) __stdcall
#define ATLAPI_(x) extern "C" __declspec(dllimport) x __stdcall
#define ATLINLINE
#elif defined(_ATL_DLL_IMPL)
#define ATLAPI extern "C" HRESULT __declspec(dllexport) __stdcall
#define ATLAPI_(x) extern "C" __declspec(dllexport) x __stdcall
#define ATLINLINE
#else
#define ATLAPI HRESULT __stdcall
#define ATLAPI_(x) x __stdcall
#define ATLINLINE inline
#endif
#if defined (_CPPUNWIND) & (defined(_ATL_EXCEPTIONS) | defined(_AFX))
#define ATLTRY(x) try{x;} catch(...) {}
#else
#define ATLTRY(x) x;
#endif
#define offsetofclass(base, derived) ((DWORD)(static_cast<base*>((derived*)_ATL_PACKING))-_ATL_PACKING)
/////////////////////////////////////////////////////////////////////////////
// Master version numbers
#define _ATL 1 // Active Template Library
#define _ATL_VER 0x0300 // Active Template Library version 3.0
/////////////////////////////////////////////////////////////////////////////
// Threading
#ifndef _ATL_SINGLE_THREADED
#ifndef _ATL_APARTMENT_THREADED
#ifndef _ATL_FREE_THREADED
#define _ATL_FREE_THREADED
#endif
#endif
#endif
#endif // __ATLDEF_H__
/////////////////////////////////////////////////////////////////////////////
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,293 @@
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
// atliface.idl : IDL source for atl.dll
//
cpp_quote("EXTERN_C const CLSID CLSID_Registrar;")
// This file will be processed by the MIDL tool to
// produce the type library (atl.tlb) and marshalling code.
import "oaidl.idl";
import "ocidl.idl";
#include <olectl.h>
[
object,
uuid(44EC053B-400F-11D0-9DCD-00A0C90391D3),
helpstring("IRegistrar Interface"),
pointer_default(unique)
]
interface IRegistrar : IUnknown
{
//////////////////////////////////////////////////////////
// Script based methods
//////////////////////////////////////////////////////////
[id(100)] HRESULT AddReplacement([in] LPCOLESTR key, [in] LPCOLESTR item);
[id(101)] HRESULT ClearReplacements();
[id(102)] HRESULT ResourceRegisterSz([in] LPCOLESTR resFileName, [in] LPCOLESTR szID, [in] LPCOLESTR szType);
[id(103)] HRESULT ResourceUnregisterSz([in] LPCOLESTR resFileName, [in] LPCOLESTR szID, [in] LPCOLESTR szType);
[id(104)] HRESULT FileRegister([in] LPCOLESTR fileName);
[id(105)] HRESULT FileUnregister([in] LPCOLESTR fileName);
[id(106)] HRESULT StringRegister([in] LPCOLESTR data);
[id(107)] HRESULT StringUnregister([in] LPCOLESTR data);
[id(120)] HRESULT ResourceRegister([in] LPCOLESTR resFileName, [in] UINT nID, [in] LPCOLESTR szType);
[id(121)] HRESULT ResourceUnregister([in] LPCOLESTR resFileName, [in] UINT nID, [in] LPCOLESTR szType);
};
//////////////////////////////////////////////////////////
// Control hosting interfaces
//////////////////////////////////////////////////////////
[
uuid(425B5AF0-65F1-11d1-9611-0000F81E0D0D),
helpstring("IDocHostUIHandlerDispatch Interface"),
pointer_default(unique)
]
interface IDocHostUIHandlerDispatch : IDispatch
{
typedef enum tagDOCHOSTUIDBLCLKDispatch {
docHostUIDblClkDEFAULT = 0,
docHostUIDblClkSHOWPROPERTIES = 1,
docHostUIDblClkSHOWCODE = 2,
} DOCHOSTUIDBLCLKDispatch ;
typedef enum tagDocHostUIFlagDispatch {
docHostUIFlagDIALOG = 1,
docHostUIFlagDISABLE_HELP_MENU = 2,
docHostUIFlagNO3DBORDER = 4,
docHostUIFlagSCROLL_NO = 8,
docHostUIFlagDISABLE_SCRIPT_INACTIVE = 16,
docHostUIFlagOPENNEWWIN = 32,
docHostUIFlagDISABLE_OFFSCREEN = 64,
docHostUIFlagFLAT_SCROLLBAR = 128,
docHostUIFlagDIV_BLOCKDEFAULT = 256,
docHostUIFlagACTIVATE_CLIENTHIT_ONLY = 512,
} DocHostUIFlagDispatch ;
HRESULT ShowContextMenu(
[in] DWORD dwID,
[in] DWORD x,
[in] DWORD y,
[in] IUnknown* pcmdtReserved,
[in] IDispatch* pdispReserved,
[out, retval] HRESULT* dwRetVal);
HRESULT GetHostInfo(
[in, out] DWORD* pdwFlags,
[in, out] DWORD* pdwDoubleClick);
HRESULT ShowUI(
[in] DWORD dwID,
[in] IUnknown* pActiveObject,
[in] IUnknown* pCommandTarget,
[in] IUnknown* pFrame,
[in] IUnknown* pDoc,
[out, retval] HRESULT* dwRetVal);
HRESULT HideUI();
HRESULT UpdateUI();
HRESULT EnableModeless(
[in] VARIANT_BOOL fEnable);
HRESULT OnDocWindowActivate(
[in] VARIANT_BOOL fActivate);
HRESULT OnFrameWindowActivate(
[in] VARIANT_BOOL fActivate);
HRESULT ResizeBorder(
[in] long left,
[in] long top,
[in] long right,
[in] long bottom,
[in] IUnknown * pUIWindow,
[in] VARIANT_BOOL fFrameWindow);
HRESULT TranslateAccelerator(
[in] DWORD hWnd,
[in] DWORD nMessage,
[in] DWORD wParam,
[in] DWORD lParam,
[in] BSTR bstrGuidCmdGroup,
[in] DWORD nCmdID,
[out, retval] HRESULT* dwRetVal);
HRESULT GetOptionKeyPath(
[out] BSTR* pbstrKey,
[in] DWORD dw);
HRESULT GetDropTarget(
[in] IUnknown* pDropTarget,
[out] IUnknown** ppDropTarget);
HRESULT GetExternal(
[out] IDispatch **ppDispatch);
HRESULT TranslateUrl(
[in] DWORD dwTranslate,
[in] BSTR bstrURLIn,
[out] BSTR* pbstrURLOut);
HRESULT FilterDataObject(
[in] IUnknown *pDO,
[out] IUnknown **ppDORet);
};
[
uuid(B6EA2050-048A-11d1-82B9-00C04FB9942E),
helpstring("IAxWinHostWindow Interface"),
pointer_default(unique)
]
interface IAxWinHostWindow : IUnknown
{
HRESULT CreateControl([in] LPCOLESTR lpTricsData, [in] HWND hWnd, [in] IStream* pStream);
HRESULT CreateControlEx([in] LPCOLESTR lpTricsData, [in] HWND hWnd, [in] IStream* pStream, [out]IUnknown** ppUnk, [in] REFIID riidAdvise, [in]IUnknown* punkAdvise);
HRESULT AttachControl([in] IUnknown* pUnkControl, [in] HWND hWnd);
HRESULT QueryControl([in] REFIID riid, [out, iid_is(riid)] void **ppvObject);
HRESULT SetExternalDispatch([in] IDispatch* pDisp);
HRESULT SetExternalUIHandler([in] IDocHostUIHandlerDispatch* pDisp);
};
[
object, dual,
uuid(B6EA2051-048A-11d1-82B9-00C04FB9942E),
helpstring("IAxWinAmbientDispatch Interface"),
pointer_default(unique)
]
interface IAxWinAmbientDispatch : IDispatch
{
[propput, helpstring("Enable or disable windowless activation")]
HRESULT AllowWindowlessActivation([in]VARIANT_BOOL bCanWindowlessActivate);
[propget, helpstring("Is windowless activation enabled")]
HRESULT AllowWindowlessActivation([out,retval]VARIANT_BOOL* pbCanWindowlessActivate);
// DISPID_AMBIENT_BACKCOLOR
[propput, helpstring("Set the background color"), id(DISPID_AMBIENT_BACKCOLOR)]
HRESULT BackColor([in]OLE_COLOR clrBackground);
[propget, helpstring("Get the background color"), id(DISPID_AMBIENT_BACKCOLOR)]
HRESULT BackColor([out,retval]OLE_COLOR* pclrBackground);
// DISPID_AMBIENT_FORECOLOR
[propput, helpstring("Set the ambient foreground color"), id(DISPID_AMBIENT_FORECOLOR)]
HRESULT ForeColor([in]OLE_COLOR clrForeground);
[propget, helpstring("Get the ambient foreground color"), id(DISPID_AMBIENT_FORECOLOR)]
HRESULT ForeColor([out,retval]OLE_COLOR* pclrForeground);
// DISPID_AMBIENT_LOCALEID
[propput, helpstring("Set the ambient locale"), id(DISPID_AMBIENT_LOCALEID)]
HRESULT LocaleID([in]LCID lcidLocaleID);
[propget, helpstring("Get the ambient locale"), id(DISPID_AMBIENT_LOCALEID)]
HRESULT LocaleID([out,retval]LCID* plcidLocaleID);
// DISPID_AMBIENT_USERMODE
[propput, helpstring("Set the ambient user mode"), id(DISPID_AMBIENT_USERMODE)]
HRESULT UserMode([in]VARIANT_BOOL bUserMode);
[propget, helpstring("Get the ambient user mode"), id(DISPID_AMBIENT_USERMODE)]
HRESULT UserMode([out,retval]VARIANT_BOOL* pbUserMode);
// DISPID_AMBIENT_DISPLAYASDEFAULT
[propput, helpstring("Enable or disable the control as default"), id(DISPID_AMBIENT_DISPLAYASDEFAULT)]
HRESULT DisplayAsDefault([in]VARIANT_BOOL bDisplayAsDefault);
[propget, helpstring("Is the control the default"), id(DISPID_AMBIENT_DISPLAYASDEFAULT)]
HRESULT DisplayAsDefault([out,retval]VARIANT_BOOL* pbDisplayAsDefault);
//midl_pragma warning(disable:2039)
// DISPID_AMBIENT_FONT
[propput, helpstring("Set the ambient font"), id(DISPID_AMBIENT_FONT)]
HRESULT Font([in]IFontDisp* pFont);
[propget, helpstring("Get the ambient font"), id(DISPID_AMBIENT_FONT)]
HRESULT Font([out,retval]IFontDisp** pFont);
//midl_pragma warning(enable:2039)
// DISPID_AMBIENT_SUPPORTSMNEMONICS
// DISPID_AMBIENT_AUTOCLIP
// DISPID_AMBIENT_APPEARANCE
// DISPID_AMBIENT_PALETTE
// DISPID_AMBIENT_TRANSFERPRIORITY
// DISPID_AMBIENT_DISPLAYNAME
// DISPID_AMBIENT_UIDEAD
// DISPID_AMBIENT_MESSAGEREFLECT
[propput, helpstring("Enable or disable message reflection"), id(DISPID_AMBIENT_MESSAGEREFLECT)]
HRESULT MessageReflect([in]VARIANT_BOOL bMsgReflect);
[propget, helpstring("Is message reflection enabled"), id(DISPID_AMBIENT_MESSAGEREFLECT)]
HRESULT MessageReflect([out,retval]VARIANT_BOOL* pbMsgReflect);
// DISPID_AMBIENT_SHOWGRABHANDLES
[propget, helpstring("Show or hide grab handles"), id(DISPID_AMBIENT_SHOWGRABHANDLES)]
HRESULT ShowGrabHandles(VARIANT_BOOL* pbShowGrabHandles);
// DISPID_AMBIENT_SHOWHATCHING
[propget, helpstring("Are grab handles enabled"), id(DISPID_AMBIENT_SHOWHATCHING)]
HRESULT ShowHatching(VARIANT_BOOL* pbShowHatching);
// DISPID_AMBIENT_SCALEUNITS
// DISPID_AMBIENT_TEXTALIGN
// IDocHostUIHandler Defaults
[propput, helpstring("Set the DOCHOSTUIFLAG flags")]
HRESULT DocHostFlags([in]DWORD dwDocHostFlags);
[propget, helpstring("Get the DOCHOSTUIFLAG flags")]
HRESULT DocHostFlags([out,retval]DWORD* pdwDocHostFlags);
[propput, helpstring("Set the DOCHOSTUIDBLCLK flags")]
HRESULT DocHostDoubleClickFlags([in]DWORD dwDocHostDoubleClickFlags);
[propget, helpstring("Get the DOCHOSTUIDBLCLK flags")]
HRESULT DocHostDoubleClickFlags([out,retval]DWORD* pdwDocHostDoubleClickFlags);
[propput, helpstring("Enable or disable context menus")]
HRESULT AllowContextMenu([in]VARIANT_BOOL bAllowContextMenu);
[propget, helpstring("Are context menus enabled")]
HRESULT AllowContextMenu([out,retval]VARIANT_BOOL* pbAllowContextMenu);
[propput, helpstring("Enable or disable UI")]
HRESULT AllowShowUI([in]VARIANT_BOOL bAllowShowUI);
[propget, helpstring("Is UI enabled")]
HRESULT AllowShowUI([out,retval]VARIANT_BOOL* pbAllowShowUI);
[propput, helpstring("Set the option key path")]
HRESULT OptionKeyPath([in]BSTR bstrOptionKeyPath);
[propget, helpstring("Get the option key path")]
HRESULT OptionKeyPath([out,retval]BSTR* pbstrOptionKeyPath);
};
[
uuid(72AD0770-6A9F-11d1-BCEC-0060088F444E),
helpstring("IInternalConnection Interface"),
pointer_default(unique)
]
interface IInternalConnection : IUnknown
{
HRESULT AddConnection();
HRESULT ReleaseConnection();
};
cpp_quote("#ifndef _ATL_DLL_IMPL")
cpp_quote("namespace ATL")
cpp_quote("{")
cpp_quote("#endif")
cpp_quote("")
cpp_quote("ATLAPI_(int) AtlAxDialogBoxW(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogProc, LPARAM dwInitParam);")
cpp_quote("ATLAPI_(int) AtlAxDialogBoxA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogProc, LPARAM dwInitParam);")
cpp_quote("#ifdef UNICODE")
cpp_quote("#define AtlAxDialogBox AtlAxDialogBoxW")
cpp_quote("#else")
cpp_quote("#define AtlAxDialogBox AtlAxDialogBoxA")
cpp_quote("#endif")
cpp_quote("")
cpp_quote("ATLAPI_(HWND) AtlAxCreateDialogW(HINSTANCE hInstance, LPCWSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogProc, LPARAM dwInitParam);")
cpp_quote("ATLAPI_(HWND) AtlAxCreateDialogA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogProc, LPARAM dwInitParam);")
cpp_quote("#ifdef UNICODE")
cpp_quote("#define AtlAxCreateDialog AtlAxCreateDialogW")
cpp_quote("#else")
cpp_quote("#define AtlAxCreateDialog AtlAxCreateDialogA")
cpp_quote("#endif")
cpp_quote("")
cpp_quote("ATLAPI AtlAxCreateControl(LPCOLESTR lpszName, HWND hWnd, IStream* pStream, IUnknown** ppUnkContainer);")
cpp_quote("ATLAPI AtlAxCreateControlEx(LPCOLESTR lpszName, HWND hWnd, IStream* pStream, ")
cpp_quote(" IUnknown** ppUnkContainer, IUnknown** ppUnkControl, ")
cpp_quote(" REFIID iidSink=IID_NULL, IUnknown* punkSink=NULL);")
cpp_quote("ATLAPI AtlAxAttachControl(IUnknown* pControl, HWND hWnd, IUnknown** ppUnkContainer);")
cpp_quote("ATLAPI_(BOOL) AtlAxWinInit();")
cpp_quote("")
cpp_quote("ATLAPI AtlAxGetHost(HWND h, IUnknown** pp);")
cpp_quote("ATLAPI AtlAxGetControl(HWND h, IUnknown** pp);")
cpp_quote("")
cpp_quote("#ifndef _ATL_DLL_IMPL")
cpp_quote("}; //namespace ATL")
cpp_quote("#endif //_ATL_DLL_IMPL")
@@ -0,0 +1,194 @@
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
#ifndef __ATLBASE_H__
#error atlimpl.cpp requires atlbase.h to be included first
#endif
/////////////////////////////////////////////////////////////////////////////
// Minimize CRT
// Specify DllMain as EntryPoint
// Turn off exception handling
// Define _ATL_MIN_CRT
#ifdef _ATL_MIN_CRT
/////////////////////////////////////////////////////////////////////////////
// Startup Code
#if defined(_WINDLL) || defined(_USRDLL)
// Declare DllMain
extern "C" BOOL WINAPI DllMain(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved);
extern "C" BOOL WINAPI _DllMainCRTStartup(HANDLE hDllHandle, DWORD dwReason, LPVOID lpReserved)
{
return DllMain(hDllHandle, dwReason, lpReserved);
}
#else
// wWinMain is not defined in winbase.h.
extern "C" int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd);
#define SPACECHAR _T(' ')
#define DQUOTECHAR _T('\"')
#ifdef _UNICODE
extern "C" void wWinMainCRTStartup()
#else // _UNICODE
extern "C" void WinMainCRTStartup()
#endif // _UNICODE
{
LPTSTR lpszCommandLine = ::GetCommandLine();
if(lpszCommandLine == NULL)
::ExitProcess((UINT)-1);
// Skip past program name (first token in command line).
// Check for and handle quoted program name.
if(*lpszCommandLine == DQUOTECHAR)
{
// Scan, and skip over, subsequent characters until
// another double-quote or a null is encountered.
do
{
lpszCommandLine = ::CharNext(lpszCommandLine);
}
while((*lpszCommandLine != DQUOTECHAR) && (*lpszCommandLine != _T('\0')));
// If we stopped on a double-quote (usual case), skip over it.
if(*lpszCommandLine == DQUOTECHAR)
lpszCommandLine = ::CharNext(lpszCommandLine);
}
else
{
while(*lpszCommandLine > SPACECHAR)
lpszCommandLine = ::CharNext(lpszCommandLine);
}
// Skip past any white space preceeding the second token.
while(*lpszCommandLine && (*lpszCommandLine <= SPACECHAR))
lpszCommandLine = ::CharNext(lpszCommandLine);
STARTUPINFO StartupInfo;
StartupInfo.dwFlags = 0;
::GetStartupInfo(&StartupInfo);
int nRet = _tWinMain(::GetModuleHandle(NULL), NULL, lpszCommandLine,
(StartupInfo.dwFlags & STARTF_USESHOWWINDOW) ?
StartupInfo.wShowWindow : SW_SHOWDEFAULT);
::ExitProcess((UINT)nRet);
}
#endif // defined(_WINDLL) | defined(_USRDLL)
/////////////////////////////////////////////////////////////////////////////
// Heap Allocation
#ifndef _DEBUG
#ifndef _MERGE_PROXYSTUB
//rpcproxy.h does the same thing as this
int __cdecl _purecall()
{
DebugBreak();
return 0;
}
#endif
#if !defined(_M_ALPHA) && !defined(_M_PPC)
//RISC always initializes floating point and always defines _fltused
extern "C" const int _fltused = 0;
#endif
static const int nExtraAlloc = 8;
static const int nOffsetBlock = nExtraAlloc/sizeof(HANDLE);
void* __cdecl malloc(size_t n)
{
void* pv = NULL;
#ifndef _ATL_NO_MP_HEAP
if (_Module.m_phHeaps == NULL)
#endif
{
pv = (HANDLE*) HeapAlloc(_Module.m_hHeap, 0, n);
}
#ifndef _ATL_NO_MP_HEAP
else
{
// overallocate to remember the heap handle
int nHeap = _Module.m_nHeap++;
HANDLE hHeap = _Module.m_phHeaps[nHeap & _Module.m_dwHeaps];
HANDLE* pBlock = (HANDLE*) HeapAlloc(hHeap, 0, n + nExtraAlloc);
if (pBlock != NULL)
{
*pBlock = hHeap;
pv = (void*)(pBlock + nOffsetBlock);
}
else
pv = NULL;
}
#endif
return pv;
}
void* __cdecl calloc(size_t n, size_t s)
{
return malloc(n*s);
}
void* __cdecl realloc(void* p, size_t n)
{
if (p == NULL)
return malloc(n);
#ifndef _ATL_NO_MP_HEAP
if (_Module.m_phHeaps == NULL)
#endif
return HeapReAlloc(_Module.m_hHeap, 0, p, n);
#ifndef _ATL_NO_MP_HEAP
else
{
HANDLE* pHeap = ((HANDLE*)p)-nOffsetBlock;
pHeap = (HANDLE*) HeapReAlloc(*pHeap, 0, pHeap, n + nExtraAlloc);
return (pHeap != NULL) ? pHeap + nOffsetBlock : NULL;
}
#endif
}
void __cdecl free(void* p)
{
if (p == NULL)
return;
#ifndef _ATL_NO_MP_HEAP
if (_Module.m_phHeaps == NULL)
#endif
HeapFree(_Module.m_hHeap, 0, p);
#ifndef _ATL_NO_MP_HEAP
else
{
HANDLE* pHeap = ((HANDLE*)p)-nOffsetBlock;
HeapFree(*pHeap, 0, pHeap);
}
#endif
}
void* __cdecl operator new(size_t n)
{
return malloc(n);
}
void __cdecl operator delete(void* p)
{
free(p);
}
#endif //_DEBUG
#endif //_ATL_MIN_CRT
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,12 @@
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
///////////////////////////////////////
// No longer used
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,12 @@
// This is a part of the Active Template Library.
// Copyright (C) 1996-1998 Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Active Template Library Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Active Template Library product.
///////////////////////////////////////
// No longer used
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,120 @@
// atl.cpp : Implementation of DLL Exports.
// You will need the NT SUR Beta 2 SDK or VC 4.2 or higher in order to build
// this project. This is because you will need MIDL 3.00.15 or higher and new
// headers and libs. If you have VC 4.2 installed, then everything should
// already be configured correctly.
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f atlps.mak in the project directory.
#include "stdafx.h"
#include "resource.h"
#include "RegObj.h"
#define _ATLBASE_IMPL
#include <atlbase.h>
#define _ATLCOM_IMPL
#include <atlcom.h>
#define _ATLWIN_IMPL
#include <atlwin.h>
#define _ATLCTL_IMPL
#include <atlctl.h>
#define _ATLCONV_IMPL
#include <atlconv.h>
#define _ATLHOST_IMPL
#include <atlhost.h>
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_Registrar, CDLLRegObject)
OBJECT_ENTRY_NON_CREATEABLE(CAxHostWindow)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
OSVERSIONINFOA info;
info.dwOSVersionInfoSize = sizeof(info);
if (GetVersionExA(&info))
{
#ifdef _UNICODE
if (info.dwPlatformId != VER_PLATFORM_WIN32_NT)
{
MessageBoxA(NULL, "Can not run Unicode version of ATL.DLL on Windows 95.\nPlease install the correct version.", "ATL", MB_ICONSTOP|MB_OK);
return FALSE;
}
#else
if (info.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
OutputDebugString(_T("Running Ansi version of ATL.DLL on Windows NT : Slight Performace loss.\nPlease install the UNICODE version on NT.\n"));
}
#endif
}
#ifdef _DEBUG
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF);
int n = 0;
_CrtSetBreakAlloc(n);
#endif
_Module.Init(ObjectMap, hInstance, &LIBID_ATLLib);
#ifdef _ATL_DEBUG_INTERFACES
int ni = 0;
_Module.m_nIndexBreakAt = ni;
#endif // _ATL_DEBUG_INTERFACES
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
#ifdef _DEBUG
::OutputDebugString(_T("ATL.DLL exiting.\n"));
#endif
_Module.Term();
AtlAxWinTerm();
#ifdef _DEBUG
if (_CrtDumpMemoryLeaks())
::MessageBeep(MB_ICONEXCLAMATION);
#endif
}
return TRUE; // ok
}
/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return _Module.GetClassObject(rclsid, riid, ppv);
}
/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
//No need to unregister typelib since ATL is a system component.
return S_OK;
}
@@ -0,0 +1,58 @@
; atl.def : Declares the module parameters.
LIBRARY ATL.DLL
EXPORTS
DllCanUnloadNow @1 PRIVATE
DllGetClassObject @2 PRIVATE
DllRegisterServer @3 PRIVATE
DllUnregisterServer @4 PRIVATE
AtlAdvise @10
AtlUnadvise @11
AtlFreeMarshalStream @12
AtlMarshalPtrInProc @13
AtlUnmarshalPtr @14
AtlModuleGetClassObject @15
AtlModuleInit @16
AtlModuleRegisterClassObjects @17
AtlModuleRegisterServer @18
AtlModuleRegisterTypeLib @19
AtlModuleRevokeClassObjects @20
AtlModuleTerm @21
AtlModuleUnregisterServer @22
AtlModuleUpdateRegistryFromResourceD @23
AtlWaitWithMessageLoop @24
AtlSetErrorInfo @25
AtlCreateTargetDC @26
AtlHiMetricToPixel @27
AtlPixelToHiMetric @28
AtlDevModeW2A @29
AtlComPtrAssign @30
AtlComQIPtrAssign @31
AtlInternalQueryInterface @32
;ATL 3.0 stuff
AtlGetVersion @34
AtlAxDialogBoxW @35
AtlAxDialogBoxA @36
AtlAxCreateDialogW @37
AtlAxCreateDialogA @38
AtlAxCreateControl @39
AtlAxCreateControlEx @40
AtlAxAttachControl @41
AtlAxWinInit @42
AtlModuleAddCreateWndData @43
AtlModuleExtractCreateWndData @44
AtlModuleRegisterWndClassInfoW @45
AtlModuleRegisterWndClassInfoA @46
AtlAxGetControl @47
AtlAxGetHost @48
AtlRegisterClassCategoriesHelper @49
AtlIPersistStreamInit_Load @50
AtlIPersistStreamInit_Save @51
AtlIPersistPropertyBag_Load @52
AtlIPersistPropertyBag_Save @53
AtlGetObjectSourceInterface @54
AtlModuleUnRegisterTypeLib @55
AtlModuleLoadTypeLib @56
AtlModuleUnregisterServerEx @57
AtlModuleAddTermFunc @58
@@ -0,0 +1,335 @@
# Microsoft Developer Studio Project File - Name="atl" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=atl - 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 "Atl.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 "Atl.mak" CFG="atl - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "atl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "atl - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "atl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "atl - Win32 Unicode Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "atl - 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 /MDd /W3 /Gm /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /Yu"stdafx.h" /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 /nologo /base:"0x5f3e0000" /version:2.0 /subsystem:windows /dll /debug /machine:I386
# SUBTRACT LINK32 /pdb:none
# Begin Custom Build
OutDir=.\.\Debug
TargetPath=.\Debug\Atl.dll
InputPath=.\Debug\Atl.dll
SOURCE=$(InputPath)
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
echo regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Unicode Debug"
# PROP BASE Intermediate_Dir ".\Unicode Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\DebugU"
# PROP Intermediate_Dir ".\DebugU"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_UNICODE" /Yu"stdafx.h" /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "_DEBUG" /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_UNICODE"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /dll /debug /machine:I386
# ADD LINK32 /nologo /base:"0x5f3e0000" /version:2.0 /subsystem:windows /dll /debug /machine:I386
# Begin Custom Build
OutDir=.\.\DebugU
TargetPath=.\DebugU\Atl.dll
InputPath=.\DebugU\Atl.dll
SOURCE=$(InputPath)
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
echo regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "atl - 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 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386
# ADD LINK32 delayimp.lib /nologo /base:"0x5f3e0000" /version:2.0 /entry:"DllMain" /subsystem:windows /dll /machine:I386 /delayload:user32.dll /delayload:gdi32.dll /delayload:ole32.dll /delayload:oleaut32.dll /delayload:advapi32.dll /delayload:olepro32.dll
# SUBTRACT LINK32 /pdb:none
# Begin Custom Build
OutDir=.\.\Release
TargetPath=.\Release\Atl.dll
InputPath=.\Release\Atl.dll
SOURCE=$(InputPath)
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
echo regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\ReleaseU"
# PROP BASE Intermediate_Dir ".\ReleaseU"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\ReleaseU"
# PROP Intermediate_Dir ".\ReleaseU"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_UNICODE" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /c
# ADD CPP /nologo /MT /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_UNICODE" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE MTL /nologo /D "NDEBUG" /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_UNICODE"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /entry:"DllMain" /subsystem:windows /dll /machine:I386
# ADD LINK32 delayimp.lib /nologo /base:"0x5f3e0000" /version:2.0 /entry:"DllMain" /subsystem:windows /dll /machine:I386 /delayload:user32.dll /delayload:gdi32.dll /delayload:ole32.dll /delayload:oleaut32.dll /delayload:advapi32.dll /delayload:olepro32.dll
# SUBTRACT LINK32 /pdb:none
# Begin Custom Build
OutDir=.\.\ReleaseU
TargetPath=.\ReleaseU\Atl.dll
InputPath=.\ReleaseU\Atl.dll
SOURCE=$(InputPath)
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
echo regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ENDIF
# Begin Target
# Name "atl - Win32 Debug"
# Name "atl - Win32 Unicode Debug"
# Name "atl - Win32 Release"
# Name "atl - Win32 Unicode Release"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
# Begin Source File
SOURCE=.\atl.cpp
# End Source File
# Begin Source File
SOURCE=.\atl.def
# End Source File
# Begin Source File
SOURCE=.\atl.idl
!IF "$(CFG)" == "atl - Win32 Debug"
# PROP Ignore_Default_Tool 1
# Begin Custom Build
InputPath=.\atl.idl
BuildCmds= \
midl /h atl.h /iid atl_i.c atl.idl
"atl.tlb" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"atl.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"atl_i.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Debug"
# PROP Ignore_Default_Tool 1
# Begin Custom Build
InputPath=.\atl.idl
BuildCmds= \
midl /h atl.h /iid atl_i.c atl.idl
"atl.tlb" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"atl.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"atl_i.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "atl - Win32 Release"
# PROP Ignore_Default_Tool 1
# Begin Custom Build
InputPath=.\atl.idl
BuildCmds= \
midl /h atl.h /iid atl_i.c atl.idl
"atl.tlb" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"atl.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"atl_i.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Release"
# PROP Ignore_Default_Tool 1
# Begin Custom Build
InputPath=.\atl.idl
BuildCmds= \
midl /h atl.h /iid atl_i.c atl.idl
"atl.tlb" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"atl.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
"atl_i.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
# End Custom Build
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\atl.rc
# End Source File
# Begin Source File
SOURCE=.\RegObj.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=.\ATLControl.h
# End Source File
# Begin Source File
SOURCE=.\RegObj.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# Begin Source File
SOURCE=.\atl.tlb
# End Source File
# Begin Source File
SOURCE=.\ATLControl.rgs
# End Source File
# Begin Source File
SOURCE=.\RegObj.rgs
# End Source File
# End Target
# End Project
@@ -0,0 +1,33 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "atl"=.\Atl.dsp - Package Owner=<4>
Package=<5>
{{{
begin source code control
"$/Sources - ATL/ATL20/src", ACDBAAAA
.
end source code control
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
@@ -0,0 +1,23 @@
#include <olectl.h>
// atl.idl : IDL source for atl.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (atl.tlb) and marshalling code.
import "oaidl.idl";
import "atliface.idl";
import "ocidl.idl";
[
uuid(44EC0535-400F-11D0-9DCD-00A0C90391D3),
version(1.0),
helpstring("ATL 2.0 Type Library")
]
library ATLLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
interface IDocHostUIHandlerDispatch;
interface IAxWinAmbientDispatch;
};
@@ -0,0 +1,603 @@
# Microsoft Developer Studio Generated NMAKE File, Based on Atl.dsp
!IF "$(CFG)" == ""
CFG=atl - Win32 Debug
!MESSAGE No configuration specified. Defaulting to atl - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "atl - Win32 Debug" && "$(CFG)" != "atl - Win32 Unicode Debug" && "$(CFG)" != "atl - Win32 Release" && "$(CFG)" != "atl - Win32 Unicode Release"
!MESSAGE Invalid configuration "$(CFG)" specified.
!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 "Atl.mak" CFG="atl - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "atl - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "atl - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "atl - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "atl - Win32 Unicode Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "atl - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\.\Debug
# End Custom Macros
ALL : "atl_i.c" "atl.tlb" "atl.h" "$(OUTDIR)\Atl.dll" ".\.\Debug\regsvr32.trg"
CLEAN :
-@erase "$(INTDIR)\atl.obj"
-@erase "$(INTDIR)\Atl.pch"
-@erase "$(INTDIR)\atl.res"
-@erase "$(INTDIR)\RegObj.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\Atl.dll"
-@erase "$(OUTDIR)\Atl.exp"
-@erase "$(OUTDIR)\Atl.ilk"
-@erase "$(OUTDIR)\Atl.lib"
-@erase "$(OUTDIR)\Atl.pdb"
-@erase ".\.\Debug\regsvr32.trg"
-@erase "atl.h"
-@erase "atl.tlb"
-@erase "atl_i.c"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MDd /W3 /Gm /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /Fp"$(INTDIR)\Atl.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
!if "$(_VCBUILD)" == "1"
CPP_PROJ=$(CPP_PROJ) /Zi
!else
CPP_PROJ=$(CPP_PROJ) /ZI
!endif
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\atl.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Atl.bsc"
BSC32_SBRS= \
LINK32=link.exe
!if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
LINK32_FLAGS=/nologo /base:"0x5f3e0000" /version:2.0 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\Atl.pdb" /debug /machine:ALPHA /def:".\atl.def" /out:"$(OUTDIR)\Atl.dll" /implib:"$(OUTDIR)\Atl.lib"
!else
LINK32_FLAGS=/nologo /base:"0x5f3e0000" /version:2.0 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\Atl.pdb" /debug /machine:I386 /def:".\atl.def" /out:"$(OUTDIR)\Atl.dll" /implib:"$(OUTDIR)\Atl.lib"
!endif
DEF_FILE= \
".\atl.def"
LINK32_OBJS= \
"$(INTDIR)\atl.obj" \
"$(INTDIR)\RegObj.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\atl.res"
"$(OUTDIR)\Atl.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
OutDir=.\.\Debug
TargetPath=.\Debug\Atl.dll
InputPath=.\Debug\Atl.dll
SOURCE=$(InputPath)
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
<<tempfile.bat
@echo off
echo regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
<<
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Debug"
OUTDIR=.\DebugU
INTDIR=.\DebugU
# Begin Custom Macros
OutDir=.\.\DebugU
# End Custom Macros
ALL : "atl_i.c" "atl.tlb" "atl.h" "$(OUTDIR)\Atl.dll" ".\.\DebugU\regsvr32.trg"
CLEAN :
-@erase "$(INTDIR)\atl.obj"
-@erase "$(INTDIR)\Atl.pch"
-@erase "$(INTDIR)\atl.res"
-@erase "$(INTDIR)\RegObj.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\Atl.dll"
-@erase "$(OUTDIR)\Atl.exp"
-@erase "$(OUTDIR)\Atl.ilk"
-@erase "$(OUTDIR)\Atl.lib"
-@erase "$(OUTDIR)\Atl.pdb"
-@erase ".\.\DebugU\regsvr32.trg"
-@erase "atl.h"
-@erase "atl.tlb"
-@erase "atl_i.c"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MDd /W3 /Gm /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_UNICODE" /Fp"$(INTDIR)\Atl.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
!if "$(_VCBUILD)" == "1"
CPP_PROJ=$(CPP_PROJ) /Zi
!else
CPP_PROJ=$(CPP_PROJ) /ZI
!endif
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\atl.res" /d "_DEBUG" /d "_UNICODE"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Atl.bsc"
BSC32_SBRS= \
LINK32=link.exe
!if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
LINK32_FLAGS=/nologo /base:"0x5f3e0000" /version:2.0 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\Atl.pdb" /debug /machine:ALPHA /def:".\atl.def" /out:"$(OUTDIR)\Atl.dll" /implib:"$(OUTDIR)\Atl.lib"
!else
LINK32_FLAGS=/nologo /base:"0x5f3e0000" /version:2.0 /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\Atl.pdb" /debug /machine:I386 /def:".\atl.def" /out:"$(OUTDIR)\Atl.dll" /implib:"$(OUTDIR)\Atl.lib"
!endif
DEF_FILE= \
".\atl.def"
LINK32_OBJS= \
"$(INTDIR)\atl.obj" \
"$(INTDIR)\RegObj.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\atl.res"
"$(OUTDIR)\Atl.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
OutDir=.\.\DebugU
TargetPath=.\DebugU\Atl.dll
InputPath=.\DebugU\Atl.dll
SOURCE=$(InputPath)
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
<<tempfile.bat
@echo off
echo regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
<<
!ELSEIF "$(CFG)" == "atl - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\.\Release
# End Custom Macros
ALL : "atl_i.c" "atl.tlb" "atl.h" "$(OUTDIR)\Atl.dll" ".\.\Release\regsvr32.trg"
CLEAN :
-@erase "$(INTDIR)\atl.obj"
-@erase "$(INTDIR)\Atl.pch"
-@erase "$(INTDIR)\atl.res"
-@erase "$(INTDIR)\RegObj.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\Atl.dll"
-@erase "$(OUTDIR)\Atl.exp"
-@erase "$(OUTDIR)\Atl.lib"
-@erase ".\.\Release\regsvr32.trg"
-@erase "atl.h"
-@erase "atl.tlb"
-@erase "atl_i.c"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /D "_ATL_MIN_CRT" /Fp"$(INTDIR)\Atl.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\atl.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Atl.bsc"
BSC32_SBRS= \
LINK32=link.exe
!if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
LINK32_FLAGS=delayimp.lib /nologo /base:"0x5f3e0000" /version:2.0 /entry:"DllMain" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\Atl.pdb" /machine:ALPHA /def:".\atl.def" /out:"$(OUTDIR)\Atl.dll" /implib:"$(OUTDIR)\Atl.lib" /delayload:user32.dll /delayload:gdi32.dll /delayload:ole32.dll /delayload:oleaut32.dll /delayload:advapi32.dll /delayload:olepro32.dll
!else
LINK32_FLAGS=delayimp.lib /nologo /base:"0x5f3e0000" /version:2.0 /entry:"DllMain" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\Atl.pdb" /machine:I386 /def:".\atl.def" /out:"$(OUTDIR)\Atl.dll" /implib:"$(OUTDIR)\Atl.lib" /delayload:user32.dll /delayload:gdi32.dll /delayload:ole32.dll /delayload:oleaut32.dll /delayload:advapi32.dll /delayload:olepro32.dll
!endif
DEF_FILE= \
".\atl.def"
LINK32_OBJS= \
"$(INTDIR)\atl.obj" \
"$(INTDIR)\RegObj.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\atl.res"
"$(OUTDIR)\Atl.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
OutDir=.\.\Release
TargetPath=.\Release\Atl.dll
InputPath=.\Release\Atl.dll
SOURCE=$(InputPath)
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
<<tempfile.bat
@echo off
echo regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
<<
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Release"
OUTDIR=.\ReleaseU
INTDIR=.\ReleaseU
# Begin Custom Macros
OutDir=.\.\ReleaseU
# End Custom Macros
ALL : "atl_i.c" "atl.tlb" "atl.h" "$(OUTDIR)\Atl.dll" ".\.\ReleaseU\regsvr32.trg"
CLEAN :
-@erase "$(INTDIR)\atl.obj"
-@erase "$(INTDIR)\Atl.pch"
-@erase "$(INTDIR)\atl.res"
-@erase "$(INTDIR)\RegObj.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\Atl.dll"
-@erase "$(OUTDIR)\Atl.exp"
-@erase "$(OUTDIR)\Atl.lib"
-@erase ".\.\ReleaseU\regsvr32.trg"
-@erase "atl.h"
-@erase "atl.tlb"
-@erase "atl_i.c"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_UNICODE" /D "_ATL_MIN_CRT" /Fp"$(INTDIR)\Atl.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\atl.res" /d "NDEBUG" /d "_UNICODE"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\Atl.bsc"
BSC32_SBRS= \
LINK32=link.exe
!if "$(PROCESSOR_ARCHITECTURE)" == "ALPHA"
LINK32_FLAGS=delayimp.lib /nologo /base:"0x5f3e0000" /version:2.0 /entry:"DllMain" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\Atl.pdb" /machine:ALPHA /def:".\atl.def" /out:"$(OUTDIR)\Atl.dll" /implib:"$(OUTDIR)\Atl.lib" /delayload:user32.dll /delayload:gdi32.dll /delayload:ole32.dll /delayload:oleaut32.dll /delayload:advapi32.dll /delayload:olepro32.dll
!else
LINK32_FLAGS=delayimp.lib /nologo /base:"0x5f3e0000" /version:2.0 /entry:"DllMain" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\Atl.pdb" /machine:I386 /def:".\atl.def" /out:"$(OUTDIR)\Atl.dll" /implib:"$(OUTDIR)\Atl.lib" /delayload:user32.dll /delayload:gdi32.dll /delayload:ole32.dll /delayload:oleaut32.dll /delayload:advapi32.dll /delayload:olepro32.dll
!endif
DEF_FILE= \
".\atl.def"
LINK32_OBJS= \
"$(INTDIR)\atl.obj" \
"$(INTDIR)\RegObj.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\atl.res"
"$(OUTDIR)\Atl.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
OutDir=.\.\ReleaseU
TargetPath=.\ReleaseU\Atl.dll
InputPath=.\ReleaseU\Atl.dll
SOURCE=$(InputPath)
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
<<tempfile.bat
@echo off
echo regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("Atl.dep")
!INCLUDE "Atl.dep"
!ELSE
!MESSAGE Warning: cannot find "Atl.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "atl - Win32 Debug" || "$(CFG)" == "atl - Win32 Unicode Debug" || "$(CFG)" == "atl - Win32 Release" || "$(CFG)" == "atl - Win32 Unicode Release"
SOURCE=.\atl.cpp
"$(INTDIR)\atl.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\Atl.pch"
".\ReleaseU\atl.obj" : $(SOURCE) "$(INTDIR)" ".\ReleaseU\Atl.pch"
SOURCE=.\atl.idl
!IF "$(CFG)" == "atl - Win32 Debug"
InputPath=.\atl.idl
"atl.tlb" "atl.h" "atl_i.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
<<tempfile.bat
@echo off
midl /h atl.h /iid atl_i.c atl.idl
<<
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Debug"
InputPath=.\atl.idl
"atl.tlb" "atl.h" "atl_i.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
<<tempfile.bat
@echo off
midl /h atl.h /iid atl_i.c atl.idl
<<
!ELSEIF "$(CFG)" == "atl - Win32 Release"
InputPath=.\atl.idl
"atl.tlb" "atl.h" "atl_i.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
<<tempfile.bat
@echo off
midl /h atl.h /iid atl_i.c atl.idl
<<
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Release"
InputPath=.\atl.idl
"atl.tlb" "atl.h" "atl_i.c" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
<<tempfile.bat
@echo off
midl /h atl.h /iid atl_i.c atl.idl
<<
!ENDIF
SOURCE=.\atl.rc
"$(INTDIR)\atl.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
".\ReleaseU\atl.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=.\RegObj.cpp
"$(INTDIR)\RegObj.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\Atl.pch"
".\ReleaseU\RegObj.obj" : $(SOURCE) "$(INTDIR)" ".\ReleaseU\Atl.pch"
SOURCE=.\StdAfx.cpp
!IF "$(CFG)" == "atl - Win32 Debug"
CPP_SWITCHES=/nologo /MDd /W3 /Gm /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /Fp"$(INTDIR)\Atl.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
!if "$(_VCBUILD)" == "1"
CPP_SWITCHES=$(CPP_SWITCHES) /Zi
!else
CPP_SWITCHES=$(CPP_SWITCHES) /ZI
!endif
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\Atl.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Debug"
CPP_SWITCHES=/nologo /MDd /W3 /Gm /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_UNICODE" /Fp"$(INTDIR)\Atl.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
!if "$(_VCBUILD)" == "1"
CPP_SWITCHES=$(CPP_SWITCHES) /Zi
!else
CPP_SWITCHES=$(CPP_SWITCHES) /ZI
!endif
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\Atl.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ELSEIF "$(CFG)" == "atl - Win32 Release"
CPP_SWITCHES=/nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_WINDLL" /D "_MBCS" /D "_ATL_MIN_CRT" /Fp"$(INTDIR)\Atl.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\Atl.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ELSEIF "$(CFG)" == "atl - Win32 Unicode Release"
CPP_SWITCHES=/nologo /MT /W3 /O1 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_WINDLL" /D "_UNICODE" /D "_ATL_MIN_CRT" /Fp"$(INTDIR)\Atl.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\Atl.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ENDIF
!ENDIF
@@ -0,0 +1,93 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""atl.rc2""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TYPELIB
//
1 TYPELIB MOVEABLE PURE "atl.tlb"
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_Registrar REGISTRY DISCARDABLE "RegObj.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_REGISTRAR_DESC "Registrar 1.0 Object"
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_PROJNAME "ATL"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#include "atl.rc2"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
#include "build_.h"
VS_VERSION_INFO VERSIONINFO
FILEVERSION _ATL_FILE_VERSION,_ATL_BUILD
PRODUCTVERSION _ATL_PRODUCT_VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Microsoft Corporation\0"
#if defined(_DUALOS)
VALUE "FileDescription", "ATL Module for Windows NT/95 (Unicode/ANSI)\0"
#elif defined(_UNICODE)
VALUE "FileDescription", "ATL Module for Windows NT (Unicode)\0"
#else
VALUE "FileDescription", "ATL Module for Windows (ANSI)\0"
#endif
VALUE "FileVersion", _ATL_USER_FILEVER "\0"
VALUE "InternalName", "ATL\0"
VALUE "LegalCopyright", "Copyright © Microsoft Corp. 1996-1998\0"
VALUE "OriginalFilename", "ATL.DLL\0"
VALUE "ProductName", "Microsoft (R) Visual C++\0"
VALUE "ProductVersion", _ATL_USER_PRODVER "\0"
VALUE "OLESelfRegister", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
@@ -0,0 +1,11 @@
LIBRARY atlPS
DESCRIPTION 'Proxy/Stub DLL'
EXPORTS
DllGetClassObject @1
DllCanUnloadNow @2
GetProxyDllInfo @3
DllRegisterServer @4
DllUnregisterServer @5
@@ -0,0 +1,14 @@
atlps.dll: dlldata.obj atl_p.obj atl_i.obj
link /dll /out:atlps.dll /def:atlps.def /entry:DllMain dlldata.obj atl_p.obj atl_i.obj kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib uuid.lib
.c.obj:
cl /c /Ox /DWIN32 /DREGISTER_PROXY_DLL $<
clean:
@del atlps.dll
@del atlps.lib
@del atlps.exp
@del dlldata.obj
@del atl_p.obj
@del atl_i.obj
@@ -0,0 +1,7 @@
// ATL Julian date build numbers (YDDD)
#define _ATL_BUILD 8168
#define _ATL_USER_BUILD "8168"
#define _ATL_PRODUCT_VERSION 6,0,0,8168
#define _ATL_FILE_VERSION 3,00
#define _ATL_USER_PRODVER "6.00.8168"
#define _ATL_USER_FILEVER "3.00.8168"
@@ -0,0 +1,5 @@
// RegObj.cpp : Implementation of CregisterApp and DLL registration.
#include "stdafx.h"
#include "resource.h" // main symbols
#include "RegObj.h"
@@ -0,0 +1,37 @@
// RegObj.h : Declaration of the CRegObject
/////////////////////////////////////////////////////////////////////////////
// register
class ATL_NO_VTABLE CDLLRegObject : public CRegObject, public CComObjectRoot,
public CComCoClass<CDLLRegObject, &CLSID_Registrar>
{
public:
CDLLRegObject() {}
~CDLLRegObject(){CRegObject::ClearReplacements();}
BEGIN_COM_MAP(CDLLRegObject)
COM_INTERFACE_ENTRY(IRegistrar)
END_COM_MAP()
DECLARE_NOT_AGGREGATABLE(CDLLRegObject)
HRESULT FinalConstruct()
{
return CComObjectRoot::FinalConstruct();
}
void FinalRelease()
{
CComObjectRoot::FinalRelease();
}
//we can't use the component because that's what we're registering
//we don't want to do the static registry because we'd have extra code
static HRESULT WINAPI UpdateRegistry(BOOL bRegister)
{
CComObject<CDLLRegObject>* p;
CComObject<CDLLRegObject>::CreateInstance(&p);
CComPtr<IRegistrar> pR;
p->QueryInterface(IID_IRegistrar, (void**)&pR);
return AtlModuleUpdateRegistryFromResourceD(&_Module,
(LPCOLESTR)MAKEINTRESOURCE(IDR_Registrar), bRegister, NULL, pR);
}
};
@@ -0,0 +1,18 @@
HKCR
{
ATL.Registrar = s 'Registrar Class'
{
CLSID = s '{44EC053A-400F-11D0-9DCD-00A0C90391D3}'
}
NoRemove CLSID
{
ForceRemove {44EC053A-400F-11D0-9DCD-00A0C90391D3} = s 'Registrar Class'
{
ProgID = s 'ATL.Registrar'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Both'
}
}
}
}
@@ -0,0 +1,41 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by atl.rc
//
#define IDS_REGISTRAR_DESC 1
#define IDS_NOT_IN_MAP 2
#define IDS_UNEXPECTED_EOS 3
#define IDS_VALUE_SET_FAILED 4
#define IDS_RECURSE_DELETE_FAILED 5
#define IDS_EXPECTING_EQUAL 6
#define IDS_CREATE_KEY_FAILED 7
#define IDS_DELETE_KEY_FAILED 8
#define IDS_OPEN_KEY_FAILED 9
#define IDS_CLOSE_KEY_FAILED 10
#define IDS_UNABLE_TO_COERCE 11
#define IDS_BAD_HKEY 12
#define IDS_MISSING_OPENKEY_TOKEN 13
#define IDS_CONVERT_FAILED 14
#define IDS_TYPE_NOT_SUPPORTED 15
#define IDS_COULD_NOT_CONCAT 16
#define IDS_COMPOUND_KEY 17
#define IDS_INVALID_MAPKEY 18
#define IDS_UNSUPPORTED_VT 19
#define IDS_VALUE_GET_FAILED 20
#define IDS_VALUE_TOO_LARGE 21
#define IDS_MISSING_VALUE_DELIMETER 22
#define IDS_DATA_NOT_BYTE_ALIGNED 23
#define IDS_PROJNAME 100
#define IDR_Registrar 101
#define IDS_STRING101 101
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 1029
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 102
#endif
#endif
@@ -0,0 +1,7 @@
// stdafx.cpp : source file that includes just the standard includes
// stdafx.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#include <atlimpl.cpp>
@@ -0,0 +1,18 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#define _WIN32_WINNT 0x0400
#define _ATL_FREE_THREADED
#define _CONVERSION_USES_THREAD_LOCALE
#define _ATL_DLL_IMPL
//#define _ATL_DEBUG_QI
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <atlctl.h>
#include <statreg.h>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
@echo off
prep /om /fc %1.exe
if errorlevel 1 goto done
profile %1 %2 %3 %4 %5 %6 %7 %8 %9
if errorlevel 1 goto done
prep /m %1
if errorlevel 1 goto done
plist %1
:done
@@ -0,0 +1,9 @@
@echo off
prep /om /fv %1.exe
if errorlevel 1 goto done
profile %1 %2 %3 %4 %5 %6 %7 %8 %9
if errorlevel 1 goto done
prep /m %1
if errorlevel 1 goto done
plist %1
:done
@@ -0,0 +1,9 @@
@echo off
prep /om /ft %1.exe
if errorlevel 1 goto done
profile %1 %2 %3 %4 %5 %6 %7 %8 %9
if errorlevel 1 goto done
prep /m %1
if errorlevel 1 goto done
plist %1
:done
@@ -0,0 +1,11 @@
rem This batch file must be invoked from the directory containing the exe to be profiled. If used from the IDE, do not change directories before running as a custom batch file.
@echo off
prep /om /lc %1.exe
if errorlevel 1 goto done
profile %1 %2 %3 %4 %5 %6 %7 %8 %9
if errorlevel 1 goto done
prep /m %1
if errorlevel 1 goto done
plist %1
:done
@@ -0,0 +1,13 @@
rem This batch file must be invoked from the directory containing the exe to be profiled. If used from the IDE, do not change directories before running as a custom batch file.
rem Line count profiling takes more time than other modes. See Help about limiting the scope of profiling if profiling a large application.
@rem off
prep /om /lv %1.exe
if errorlevel 1 goto done
profile %1 %2 %3 %4 %5 %6 %7 %8 %9
if errorlevel 1 goto done
prep /m %1
if errorlevel 1 goto done
plist %1
:done
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,130 @@
[profiler]
exclude:int64.lib
exclude:msacm32.lib
exclude:rpcdce4.lib
exclude:vfw32.lib
exclude:wsetargv.obj
exclude:setargv.obj
exclude:oldnames.lib
exclude:newmode.obj
exclude:msvcrt.lib
exclude:libcmt.lib
exclude:libc.lib
exclude:binmode.obj
exclude:chkstk.obj
exclude:commode.obj
exclude:fp10.obj
exclude:glu32.lib
exclude:glaux.lib
exclude:opengl32.lib
exclude:wst.lib
exclude:win32api.csv
exclude:penter.lib
exclude:olesvr32.lib
exclude:olecli32.lib
exclude:libcx32.lib
exclude:largeint.lib
exclude:ctl3d32.lib
exclude:cap.lib
exclude:winspool.lib
exclude:winstrm.lib
exclude:wsock32.lib
exclude:winmm.lib
exclude:win32spl.lib
exclude:user32.lib
exclude:uuid.lib
exclude:vdmdbg.lib
exclude:version.lib
exclude:scrnsave.lib
exclude:shell32.lib
exclude:snmp.lib
exclude:rpcrt4.lib
exclude:rasapi32.lib
exclude:rpcndr.lib
exclude:rpcns4.lib
exclude:odbc32.lib
exclude:odbccp32.lib
exclude:ole32.lib
exclude:oleaut32.lib
exclude:netapi32.lib
exclude:kernel32.lib
exclude:lmmib2.lib
exclude:lz32.lib
exclude:mgmtapi.lib
exclude:mpr.lib
exclude:nddeapi.lib
exclude:gdi32.lib
exclude:inetmib1.lib
exclude:dlcapi.lib
exclude:advapi32.lib
exclude:comctl32.lib
exclude:comdlg32.lib
exclude:uafxdwd.lib
exclude:uafxdw.lib
exclude:uafxcwd.lib
exclude:uafxcw.lib
exclude:nafxdwd.lib
exclude:nafxdw.lib
exclude:nafxcwd.lib
exclude:nafxcw.lib
exclude:mfcuiw32.lib
exclude:mfcuia32.lib
exclude:mfco30ud.lib
exclude:mfco30u.lib
exclude:mfco30d.lib
exclude:mfco30.lib
exclude:mfcd30d.lib
exclude:mfcd30.lib
exclude:mfc30ud.lib
exclude:mfcans32.lib
exclude:mfc30u.lib
exclude:mfc30d.lib
exclude:mfc30.lib
exclude:ctl3d32s.lib
exclude:dao2532.lib
exclude:imm32.lib
exclude:libcd.lib
exclude:libcmtd.lib
exclude:libcpsx.lib
exclude:mfcapwz.lib
exclude:msvcrtd.lib
exclude:oledlg.lib
exclude:olepro32.lib
exclude:penwin32.lib
exclude:pkpd32.lib
exclude:psxdll.lib
exclude:psxrtl.lib
exclude:riched32.lib
exclude:tapi32.lib
exclude:thunk32.lib
exclude:uuid2.lib
exclude:wow32.lib
exclude:mfc40.lib
exclude:mfc40d.lib
exclude:mfc40u.lib
exclude:mfc40ud.lib
exclude:mfcd40.lib
exclude:mfcd40d.lib
exclude:mfcn40.lib
exclude:mfcn40d.lib
exclude:mfcn40u.lib
exclude:mfcn40ud.lib
exclude:mfco40.lib
exclude:mfco40d.lib
exclude:mfco40u.lib
exclude:mfco40ud.lib
exclude:mfcs40.lib
exclude:mfcs40d.lib
exclude:mfcs40u.lib
exclude:mfcs40ud.lib
exclude:console.lib
exclude:libf.lib
exclude:libfmt.lib
exclude:msfrt.lib
exclude:qwin.lib
exclude:qwin_mdi.lib
exclude:qwin_sdi.lib
exclude:msfnls.lib
exclude:msfwin.lib
exclude:portlib.lib
exclude:dialogm.lib
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,33 @@
@echo off
rem
rem Root of Visual Developer Studio Common files.
set VSCommonDir=C:\PROGRA~1\MICROS~3\Common
rem
rem Root of Visual Developer Studio installed files.
rem
set MSDevDir=C:\PROGRA~1\MICROS~3\Common\msdev98
rem
rem Root of Visual C++ installed files.
rem
set MSVCDir=C:\PROGRA~1\MICROS~3\VC98
rem
rem VcOsDir is used to help create either a Windows 95 or Windows NT specific path.
rem
set VcOsDir=WIN95
if "%OS%" == "Windows_NT" set VcOsDir=WINNT
rem
echo Setting environment for using Microsoft Visual C++ tools.
rem
if "%OS%" == "Windows_NT" set PATH=%MSDevDir%\BIN;%MSVCDir%\BIN;%VSCommonDir%\TOOLS\%VcOsDir%;%VSCommonDir%\TOOLS;%PATH%
if "%OS%" == "" set PATH="%MSDevDir%\BIN";"%MSVCDir%\BIN";"%VSCommonDir%\TOOLS\%VcOsDir%";"%VSCommonDir%\TOOLS";"%windir%\SYSTEM";"%PATH%"
set INCLUDE=%MSVCDir%\ATL\INCLUDE;%MSVCDir%\INCLUDE;%MSVCDir%\MFC\INCLUDE;%INCLUDE%
set LIB=%MSVCDir%\LIB;%MSVCDir%\MFC\LIB;%LIB%
set VcOsDir=
set VSCommonDir=
@@ -0,0 +1,191 @@
/***
*calloc.c - allocate storage for an array from the heap
*
* Copyright (c) 1989-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the calloc() function.
*
*******************************************************************************/
#ifdef WINHEAP
#include <malloc.h>
#include <string.h>
#include <winheap.h>
#include <windows.h>
#include <internal.h>
#include <mtdll.h>
#include <dbgint.h>
/***
*void *calloc(size_t num, size_t size) - allocate storage for an array from
* the heap
*
*Purpose:
* Allocate a block of memory from heap big enough for an array of num
* elements of size bytes each, initialize all bytes in the block to 0
* and return a pointer to it.
*
*Entry:
* size_t num - number of elements in the array
* size_t size - size of each element
*
*Exit:
* Success: void pointer to allocated block
* Failure: NULL
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
void * __cdecl _calloc_base (size_t num, size_t size)
{
size_t size_sbh;
void * pvReturn;
size_t org_num = num, org_size = size;
size_sbh = size = size * num;
/* round up to the nearest paragraph */
if (size <= _HEAP_MAXREQ)
{
if (size == 0)
size = 1;
size = (size + BYTES_PER_PARA - 1) & ~(BYTES_PER_PARA - 1);
}
for (;;)
{
pvReturn = NULL;
if (size <= _HEAP_MAXREQ)
{
if ( __active_heap == __V6_HEAP )
{
if ( size_sbh <= __sbh_threshold )
{
// Allocate the block from the small-block heap and
// initialize it with zeros.
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
pvReturn = __sbh_alloc_block(size_sbh);
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
if (pvReturn != NULL)
memset(pvReturn, 0, size_sbh);
}
}
else if ( __active_heap == __V5_HEAP )
{
if ( size <= __old_sbh_threshold )
{
// Allocate the block from the small-block heap and
// initialize it with zeros.
#ifdef _MT
_mlock(_HEAP_LOCK);
__try {
#endif /* _MT */
pvReturn = __old_sbh_alloc_block(size >> _OLD_PARASHIFT);
#ifdef _MT
}
__finally {
_munlock(_HEAP_LOCK);
}
#endif /* _MT */
if ( pvReturn != NULL )
memset(pvReturn, 0, size);
}
}
if (pvReturn == NULL)
pvReturn = HeapAlloc(_crtheap, HEAP_ZERO_MEMORY, size);
}
if (pvReturn || _newmode == 0)
{
return pvReturn;
}
/* call installed new handler */
if (!_callnewh(size))
return NULL;
/* new handler was successful -- try to allocate again */
}
}
#else /* WINHEAP */
#include <cruntime.h>
#include <heap.h>
#include <malloc.h>
#include <mtdll.h>
#include <stddef.h>
#include <dbgint.h>
/***
*void *calloc(size_t num, size_t size) - allocate storage for an array from
* the heap
*
*Purpose:
* Allocate a block of memory from heap big enough for an array of num
* elements of size bytes each, initialize all bytes in the block to 0
* and return a pointer to it.
*
*Entry:
* size_t num - number of elements in the array
* size_t size - size of each element
*
*Exit:
* Success: void pointer to allocated block block
* Failure: NULL
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
void * __cdecl _calloc_base (
size_t num,
size_t size
)
{
void *retp;
REG1 size_t *startptr;
REG2 size_t *lastptr;
/* try to malloc the requested space
*/
retp = _malloc_base(size *= num);
/* if malloc() succeeded, initialize the allocated space to zeros.
* note the assumptions that the size of the allocation block is an
* integral number of sizeof(size_t) bytes and that (size_t)0 is
* sizeof(size_t) bytes of 0.
*/
if ( retp != NULL ) {
startptr = (size_t *)retp;
lastptr = startptr + ((size + sizeof(size_t) - 1) /
sizeof(size_t));
while ( startptr < lastptr )
*(startptr++) = 0;
}
return retp;
}
#endif /* WINHEAP */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,22 @@
/***
*delete.cxx - defines C++ delete routine
*
* Copyright (c) 1990-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines C++ delete routine.
*
*******************************************************************************/
#ifndef _DEBUG
#include <cruntime.h>
#include <malloc.h>
#include <new.h>
void operator delete( void * p )
{
free( p );
}
#endif /* _DEBUG */
@@ -0,0 +1,157 @@
/***
*expand.c - Win32 expand heap routine
*
* Copyright (c) 1991-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
*
*******************************************************************************/
#ifdef WINHEAP
#include <cruntime.h>
#include <malloc.h>
#include <winheap.h>
#include <windows.h>
#include <mtdll.h>
#include <dbgint.h>
/***
*void *_expand(void *pblck, size_t newsize) - expand/contract a block of memory
* in the heap
*
*Purpose:
* Resizes a block in the heap to newsize bytes. newsize may be either
* greater (expansion) or less (contraction) than the original size of
* the block. The block is NOT moved.
*
* NOTES:
*
* (1) In this implementation, if the block cannot be grown to the
* desired size, the resulting block will NOT be grown to the max
* possible size. (That is, either it works or it doesn't.)
*
* (2) Unlike other implementations, you can NOT pass a previously
* freed block to this routine and expect it to work.
*
*Entry:
* void *pblck - pointer to block in the heap previously allocated
* by a call to malloc(), realloc() or _expand().
*
* size_t newsize - requested size for the resized block
*
*Exit:
* Success: Pointer to the resized memory block (i.e., pblck)
* Failure: NULL
*
*Uses:
*
*Exceptions:
* If pblck does not point to a valid allocation block in the heap,
* _expand() will behave unpredictably and probably corrupt the heap.
*
*******************************************************************************/
void * __cdecl _expand_base (void * pBlock, size_t newsize)
{
PHEADER pHeader;
void * pvReturn;
/* validate size */
if ( newsize > _HEAP_MAXREQ )
return NULL;
if ( __active_heap == __V6_HEAP )
{
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
// if allocation block lies within the small-block heap,
// try to resize it there
if ((pHeader = __sbh_find_block(pBlock)) != NULL)
{
pvReturn = NULL;
if ( (newsize <= __sbh_threshold) &&
__sbh_resize_block(pHeader, pBlock, newsize) )
pvReturn = pBlock;
}
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
if ( pHeader == NULL )
{
// force nonzero size and round up to next paragraph
if (newsize == 0)
newsize = 1;
newsize = (newsize + BYTES_PER_PARA - 1) & ~(BYTES_PER_PARA - 1);
pvReturn = HeapReAlloc(_crtheap, HEAP_REALLOC_IN_PLACE_ONLY,
pBlock, newsize);
}
}
else if ( __active_heap == __V5_HEAP )
{
__old_sbh_region_t *preg;
__old_sbh_page_t * ppage;
__old_page_map_t * pmap;
// force nonzero size and round up to next paragraph
if (newsize == 0)
newsize = 1;
newsize = (newsize + _OLD_PARASIZE - 1) & ~(_OLD_PARASIZE - 1);
#ifdef _MT
_mlock(_HEAP_LOCK);
__try {
#endif /* _MT */
pmap = __old_sbh_find_block(pBlock, &preg, &ppage);
// allocation block lies within the small-block heap, try to resize
// it there.
if ( pmap != NULL )
{
// *pBlock lies within the small-block heap, try to resize it
// there
pvReturn = NULL;
if ( (newsize <= __old_sbh_threshold) &&
__old_sbh_resize_block(preg, ppage, pmap,
newsize >> _OLD_PARASHIFT) )
pvReturn = pBlock;
return pvReturn;
}
#ifdef _MT
}
__finally {
_munlock(_HEAP_LOCK);
}
#endif /* _MT */
if ( pmap == NULL )
pvReturn = HeapReAlloc(_crtheap, HEAP_REALLOC_IN_PLACE_ONLY,
pBlock, newsize);
}
else // __active_heap == __SYSTEM_HEAP
{
// force nonzero size and round up to next paragraph
if (newsize == 0)
newsize = 1;
newsize = (newsize + BYTES_PER_PARA - 1) & ~(BYTES_PER_PARA - 1);
pvReturn = HeapReAlloc(_crtheap, HEAP_REALLOC_IN_PLACE_ONLY,
pBlock, newsize);
}
return pvReturn;
}
#endif /* WINHEAP */
+218
View File
@@ -0,0 +1,218 @@
/***
*free.c - free an entry in the heap
*
* Copyright (c) 1989-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the following functions:
* free() - free a memory block in the heap
*
*******************************************************************************/
#ifdef WINHEAP
#include <cruntime.h>
#include <malloc.h>
#include <winheap.h>
#include <windows.h>
#include <internal.h>
#include <mtdll.h>
#include <dbgint.h>
/***
*void free(pblock) - free a block in the heap
*
*Purpose:
* Free a memory block in the heap.
*
* Special ANSI Requirements:
*
* (1) free(NULL) is benign.
*
*Entry:
* void *pblock - pointer to a memory block in the heap
*
*Return:
* <void>
*
*******************************************************************************/
void __cdecl _free_base (void * pBlock)
{
PHEADER pHeader;
if (pBlock == NULL)
return;
if ( __active_heap == __V6_HEAP )
{
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
if ((pHeader = __sbh_find_block(pBlock)) != NULL)
__sbh_free_block(pHeader, pBlock);
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
if (pHeader == NULL)
HeapFree(_crtheap, 0, pBlock);
}
else if ( __active_heap == __V5_HEAP )
{
__old_sbh_region_t *preg;
__old_sbh_page_t * ppage;
__old_page_map_t * pmap;
#ifdef _MT
_mlock(_HEAP_LOCK );
__try {
#endif /* _MT */
if ( (pmap = __old_sbh_find_block(pBlock, &preg, &ppage)) != NULL )
__old_sbh_free_block(preg, ppage, pmap);
#ifdef _MT
}
__finally {
_munlock(_HEAP_LOCK );
}
#endif /* _MT */
if (pmap == NULL)
HeapFree(_crtheap, 0, pBlock);
}
else // __active_heap == __SYSTEM_HEAP
HeapFree(_crtheap, 0, pBlock);
return;
}
#else /* WINHEAP */
#include <cruntime.h>
#include <heap.h>
#include <malloc.h>
#include <mtdll.h>
#include <stdlib.h>
#include <dbgint.h>
/***
*void free(pblock) - free a block in the heap
*
*Purpose:
* Free a memory block in the heap.
*
* Special Notes For Multi-thread: The non-multi-thread version is renamed
* to _free_lk(). The multi-thread free() simply locks the heap, calls
* _free_lk(), then unlocks the heap and returns.
*
*Entry:
* void *pblock - pointer to a memory block in the heap
*
*Return:
* <void>
*
*******************************************************************************/
#ifdef _MT
void __cdecl _free_base (
void *pblock
)
{
/* lock the heap
*/
_mlock(_HEAP_LOCK);
/* free the block
*/
_free_base_lk(pblock);
/* unlock the heap
*/
_munlock(_HEAP_LOCK);
}
/***
*void _free_lk(pblock) - non-locking form of free
*
*Purpose:
* Same as free() except that no locking is performed
*
*Entry:
* See free
*
*Return:
*
*******************************************************************************/
void __cdecl _free_base_lk (
#else /* _MT */
void __cdecl _free_base (
#endif /* _MT */
REG1 void *pblock
)
{
REG2 _PBLKDESC pdesc;
/*
* If the pointer is NULL, just return [ANSI].
*/
if (pblock == NULL)
return;
/*
* Point to block header and get the pointer back to the heap desc.
*/
pblock = (char *)pblock - _HDRSIZE;
pdesc = *(_PBLKDESC*)pblock;
/*
* Validate the back pointer.
*/
if (_ADDRESS(pdesc) != pblock)
_heap_abort();
/*
* Pointer is ok. Mark block free.
*/
_SET_FREE(pdesc);
/*
* Check for special conditions under which the rover is reset.
*/
if ( (_heap_resetsize != 0xffffffff) &&
(_heap_desc.proverdesc->pblock > pdesc->pblock) &&
(_BLKSIZE(pdesc) >= _heap_resetsize) )
{
_heap_desc.proverdesc = pdesc;
}
#if !defined (_M_MPPC) && !defined (_M_M68K)
else if ( _heap_desc.proverdesc == pdesc->pnextdesc )
{
_heap_desc.proverdesc = pdesc;
}
#endif /* !defined (_M_MPPC) && !defined (_M_M68K) */
}
#endif /* WINHEAP */
@@ -0,0 +1,399 @@
// fstream standard header
#if _MSC_VER > 1000 /*IFSTRIP=IGN*/
#pragma once
#endif
#ifndef _FSTREAM_
#define _FSTREAM_
#include <istream>
#include <new>
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
_STD_BEGIN
extern _CRTIMP2 FILE *__cdecl __Fiopen(const char *,ios_base::openmode);
// TEMPLATE FUNCTION _Fgetc
template<class _E> inline
bool _Fgetc(_E& _C, _Filet *_Fi)
{return (fread(&_C, sizeof (_E), 1, _Fi) == 1); }
inline bool _Fgetc(char& _C, _Filet *_Fi)
{int _Ch;
if ((_Ch = fgetc(_Fi)) == EOF)
return (false);
else
{_C = (char)_Ch;
return (true); }}
inline bool _Fgetc(wchar_t& _C, _Filet *_Fi)
{_Wint_t _Ch;
if ((_Ch = fgetwc(_Fi)) == WEOF)
return (false);
else
{_C = _Ch;
return (true); }}
// TEMPLATE FUNCTION _Fputc
template<class _E> inline
bool _Fputc(_E _C, _Filet *_Fi)
{return (fwrite(&_C, sizeof (_E), 1, _Fi) == 1); }
inline bool _Fputc(char _C, _Filet *_Fi)
{return (fputc(_C, _Fi) != EOF); }
inline bool _Fputc(wchar_t _C, _Filet *_Fi)
{return (fputwc(_C, _Fi) != WEOF); }
// TEMPLATE FUNCTION _Ungetc
template<class _E> inline
bool _Ungetc(const _E& _C, _Filet *_Fi, size_t _N)
{const unsigned char *_P = (const unsigned char *)&_C;
for (_P += _N; 0 < _N && ungetc(*--_P, _Fi) != EOF; --_N)
;
if (_N == 0)
return (true);
else
{for (; _N < sizeof (_E); ++_N)
fgetc(_Fi);
return (false); }}
template<class _E> inline
bool _Ungetc(const _E& _C, _Filet *_Fi)
{return (_Ungetc(_C, _Fi, sizeof (_E))); }
inline bool _Ungetc(char _C, _Filet *_Fi)
{return (ungetc((unsigned char)_C, _Fi) != EOF); }
inline bool _Ungetc(wchar_t _C, _Filet *_Fi)
{return (ungetwc(_C, _Fi) != WEOF); }
// TEMPLATE CLASS basic_filebuf
template<class _E, class _Tr = char_traits<_E> >
class basic_filebuf : public basic_streambuf<_E, _Tr> {
public:
typedef basic_filebuf<_E, _Tr> _Myt;
typedef basic_streambuf<_E, _Tr> _Mysb;
typedef codecvt<_E, char, _Tr::state_type> _Cvt;
basic_filebuf(_Filet *_F = 0)
: _Loc(), _Mysb() {_Init(_F, _Newfl); }
basic_filebuf(_Uninitialized)
: _Loc(_Noinit), _Mysb(_Noinit) {}
virtual ~basic_filebuf()
{if (_Closef)
close();
delete _Str; }
enum _Initfl {_Newfl, _Openfl, _Closefl};
bool is_open() const
{return (_File != 0); }
_Myt *open(const char *_S, ios_base::openmode _M)
{_Filet *_Fp;
if (_File != 0 || (_Fp = __Fiopen(_S, _M)) == 0)
return (0);
_Init(_Fp, _Openfl);
_Initcvt();
return (this); }
_Myt *open(const char *_N, ios::open_mode _M)
{return (open(_N, (ios::openmode)_M)); }
_Myt *close()
{if (_File != 0 && fclose(_File) == 0)
{_Init(0, _Closefl);
return (this); }
else
return (0); }
protected:
virtual int_type overflow(int_type _C = _Tr::eof())
{if (_Tr::eq_int_type(_Tr::eof(), _C))
return (_Tr::not_eof(_C));
else if (pptr() != 0 && pptr() < epptr())
{*_Pninc() = _Tr::to_char_type(_C);
return (_C); }
else if (_File == 0)
return (_Tr::eof());
else if (_Pcvt == 0)
return (_Fputc(_Tr::to_char_type(_C), _File)
? _C : _Tr::eof());
else
{const int _NC = 8;
const _E _X = _Tr::to_char_type(_C);
const _E *_S;
char *_D;
_Str->erase();
for (size_t _I = _NC; ; _I += _NC)
{_Str->append(_NC, '\0');
switch (_Pcvt->out(_State,
&_X, &_X + 1, _S,
_Str->begin(), _Str->end(), _D))
{case codecvt_base::partial:
if (_S == &_X)
return (_Tr::eof());
case codecvt_base::ok: // can fall through
{size_t _N = _D - _Str->begin();
return (fwrite(_Str->begin(), 1, _N, _File)
== _N ? _C : _Tr::eof()); }
case codecvt_base::noconv:
return (_Fputc(_X, _File) ? _C : _Tr::eof());
default:
return (_Tr::eof()); }}}}
virtual int_type pbackfail(int_type _C = _Tr::eof())
{if (gptr() != 0 && eback() < gptr()
&& (_Tr::eq_int_type(_Tr::eof(), _C)
|| _Tr::eq_int_type(_Tr::to_int_type(gptr()[-1]),
_C)))
{_Gndec();
return (_Tr::not_eof(_C)); }
else if (_File == 0 || _Tr::eq_int_type(_Tr::eof(), _C))
return (_Tr::eof());
else if (_Pcvt == 0)
return (_Ungetc(_Tr::to_char_type(_C), _File)
? _C : _Tr::eof());
else if (0 < _Str->size()
&& _Ungetc(*_Str->begin(), _File, _Str->size()))
{_Str->erase();
_State = _State0;
return (_C); }
else
return (_Tr::eof()); }
virtual int_type underflow()
{if (gptr() != 0 && gptr() < egptr())
return (_Tr::to_int_type(*gptr()));
else
return (pbackfail(uflow())); }
virtual int_type uflow()
{if (gptr() != 0 && gptr() < egptr())
return (_Tr::to_int_type(*_Gninc()));
else if (_File == 0)
return (_Tr::eof());
else if (_Pcvt == 0)
{_E _C;
return (_Fgetc(_C, _File) ? _Tr::to_int_type(_C)
: _Tr::eof()); }
else
for (_State0 = _State, _Str->erase(); ; )
{_E _X, *_D;
const char *_S;
int _C = fgetc(_File);
if (_C == EOF)
return (_Tr::eof()); // partial char?
_Str->append(1, (char)_C);
_State = _State0;
switch (_Pcvt->in(_State,
_Str->begin(), _Str->end(), _S,
&_X, &_X + 1, _D))
{case codecvt_base::partial:
break;
case codecvt_base::noconv:
if (_Str->size() < sizeof (_E))
break;
memcpy(&_X, _Str->begin(), sizeof (_E));
case codecvt_base::ok: // can fall through
return (_Tr::to_int_type(_X));
default:
return (_Tr::eof()); }}}
virtual pos_type seekoff(off_type _O, ios_base::seekdir _Way,
ios_base::openmode =
(ios_base::openmode)(ios_base::in | ios_base::out))
{fpos_t _Fp;
if (_File == 0 || fseek(_File, _O, _Way) != 0
|| fgetpos(_File, &_Fp) != 0)
return (pos_type(_BADOFF));
return (pos_type(_State, _Fp)); }
virtual pos_type seekpos(pos_type _P,
ios_base::openmode =
(ios_base::openmode)(ios_base::in | ios_base::out))
{fpos_t _Fp = _P.get_fpos_t();
off_type _Off = (off_type)_P - _FPOSOFF(_Fp);
if (_File == 0
|| fsetpos(_File, &_Fp) != 0
|| _Off != 0 && fseek(_File, _Off, SEEK_CUR) != 0
|| fgetpos(_File, &_Fp) != 0)
return (pos_type(_BADOFF));
if (_Str != 0)
_State = _P.state(), _Str->erase();
return (pos_type(_State, _Fp)); }
virtual _Mysb *setbuf(_E *_S, streamsize _N)
{return (_File == 0 || setvbuf(_File, (char *)_S,
_IOFBF, _N * sizeof (_E)) != 0 ? 0 : this); }
virtual int sync()
{return (_File == 0 || 0 <= fflush(_File) ? 0 : -1); }
void _Init(_Filet *_Fp, _Initfl _Which)
{static _Tr::state_type _Stinit;
_Closef = _Which == _Openfl;
if (_Which == _Newfl)
{_Loc.locale::~locale();
new (&_Loc) locale;
_Str = 0; }
_Mysb::_Init();
if (_Fp != 0 && !_Closef && sizeof (_E) == 1)
{_Mysb::_Init((_E **)&_Fp->_base,
(_E **)&_Fp->_ptr, &_Fp->_cnt,
(_E **)&_Fp->_base, (_E **)&_Fp->_ptr,
&_Fp->_cnt); }
_File = _Fp;
_State = _Stinit;
_State0 = _Stinit;
_Pcvt = 0; }
void _Initcvt()
{_Pcvt = (_Cvt *)&_USE(getloc(), _Cvt);
_Loc = _ADDFAC(_Loc, _Pcvt);
if (_Pcvt->always_noconv())
_Pcvt = 0;
if (_Str == 0)
_Str = new string; }
private:
_Cvt *_Pcvt;
_Tr::state_type _State0;
_Tr::state_type _State;
string *_Str;
bool _Closef;
locale _Loc;
_Filet *_File;
};
#ifdef _DLL
#ifdef __FORCE_INSTANCE
template class _CRTIMP2 basic_filebuf<char, char_traits<char> >;
template class _CRTIMP2 basic_filebuf<wchar_t, char_traits<wchar_t> >;
#else // __FORCE_INSTANCE
#pragma warning(disable:4231) /* the extern before template is a non-standard extension */
extern template class _CRTIMP2 basic_filebuf<char, char_traits<char> >;
extern template class _CRTIMP2 basic_filebuf<wchar_t, char_traits<wchar_t> >;
#pragma warning(default:4231) /* restore previous warning */
#endif // __FORCE_INSTANCE
#endif // _DLL
// TEMPLATE CLASS basic_ifstream
template<class _E, class _Tr = char_traits<_E> >
class basic_ifstream : public basic_istream<_E, _Tr> {
public:
typedef basic_ifstream<_E, _Tr> _Myt;
typedef basic_filebuf<_E, _Tr> _Myfb;
basic_ifstream()
: basic_istream<_E, _Tr>(&_Fb) {}
explicit basic_ifstream(const char *_S,
ios_base::openmode _M = in)
: basic_istream<_E, _Tr>(&_Fb)
{if (_Fb.open(_S, _M | in) == 0)
setstate(failbit); }
virtual ~basic_ifstream()
{}
_Myfb *rdbuf() const
{return ((_Myfb *)&_Fb); }
bool is_open() const
{return (_Fb.is_open()); }
void open(const char *_S, ios_base::openmode _M = in)
{if (_Fb.open(_S, _M | in) == 0)
setstate(failbit); }
void open(const char *_S, ios_base::open_mode _M)
{open(_S, (openmode)_M); }
void close()
{if (_Fb.close() == 0)
setstate(failbit); }
private:
_Myfb _Fb;
};
#ifdef _DLL
#ifdef __FORCE_INSTANCE
template class _CRTIMP2 basic_ifstream<char, char_traits<char> >;
template class _CRTIMP2 basic_ifstream<wchar_t, char_traits<wchar_t> >;
#else // __FORCE_INSTANCE
#pragma warning(disable:4231) /* the extern before template is a non-standard extension */
extern template class _CRTIMP2 basic_ifstream<char, char_traits<char> >;
extern template class _CRTIMP2 basic_ifstream<wchar_t, char_traits<wchar_t> >;
#pragma warning(default:4231) /* restore previous warning */
#endif // __FORCE_INSTANCE
#endif // _DLL
// TEMPLATE CLASS basic_ofstream
template<class _E, class _Tr = char_traits<_E> >
class basic_ofstream : public basic_ostream<_E, _Tr> {
public:
typedef basic_ofstream<_E, _Tr> _Myt;
typedef basic_filebuf<_E, _Tr> _Myfb;
basic_ofstream()
: basic_ostream<_E, _Tr>(&_Fb) {}
explicit basic_ofstream(const char *_S,
ios_base::openmode _M = out | trunc)
: basic_ostream<_E, _Tr>(&_Fb)
{if (_Fb.open(_S, _M | out) == 0)
setstate(failbit); }
virtual ~basic_ofstream()
{}
_Myfb *rdbuf() const
{return ((_Myfb *)&_Fb); }
bool is_open() const
{return (_Fb.is_open()); }
void open(const char *_S, ios_base::openmode _M = out | trunc)
{if (_Fb.open(_S, _M | out) == 0)
setstate(failbit); }
void open(const char *_S, ios_base::open_mode _M)
{open(_S, (openmode)_M); }
void close()
{if (_Fb.close() == 0)
setstate(failbit); }
private:
_Myfb _Fb;
};
#ifdef _DLL
#ifdef __FORCE_INSTANCE
template class _CRTIMP2 basic_ofstream<char, char_traits<char> >;
template class _CRTIMP2 basic_ofstream<wchar_t, char_traits<wchar_t> >;
#else // __FORCE_INSTANCE
#pragma warning(disable:4231) /* the extern before template is a non-standard extension */
extern template class _CRTIMP2 basic_ofstream<char, char_traits<char> >;
extern template class _CRTIMP2 basic_ofstream<wchar_t, char_traits<wchar_t> >;
#pragma warning(default:4231) /* restore previous warning */
#endif // __FORCE_INSTANCE
#endif // _DLL
// TEMPLATE CLASS basic_fstream
template<class _E, class _Tr = char_traits<_E> >
class basic_fstream : public basic_iostream<_E, _Tr> {
public:
basic_fstream()
: basic_iostream<_E, _Tr>(&_Fb) {}
explicit basic_fstream(const char *_S,
ios_base::openmode _M = in | out)
: basic_iostream<_E, _Tr>(&_Fb)
{if (_Fb.open(_S, _M) == 0)
setstate(failbit); }
virtual ~basic_fstream()
{}
basic_filebuf<_E, _Tr> *rdbuf() const
{return ((basic_filebuf<_E, _Tr> *)&_Fb); }
bool is_open() const
{return (_Fb.is_open()); }
void open(const char *_S, ios_base::openmode _M = in | out)
{if (_Fb.open(_S, _M) == 0)
setstate(failbit); }
void open(const char *_S, ios_base::open_mode _M)
{open(_S, (openmode)_M); }
void close()
{if (_Fb.close() == 0)
setstate(failbit); }
private:
basic_filebuf<_E, _Tr> _Fb;
};
#ifdef _DLL
#ifdef __FORCE_INSTANCE
template class _CRTIMP2 basic_fstream<char, char_traits<char> >;
template class _CRTIMP2 basic_fstream<wchar_t, char_traits<wchar_t> >;
#else // __FORCE_INSTANCE
#pragma warning(disable:4231) /* the extern before template is a non-standard extension */
extern template class _CRTIMP2 basic_fstream<char, char_traits<char> >;
extern template class _CRTIMP2 basic_fstream<wchar_t, char_traits<wchar_t> >;
#pragma warning(default:4231) /* restore previous warning */
#endif // __FORCE_INSTANCE
#endif // _DLL
_STD_END
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _FSTREAM_ */
/*
* Copyright (c) 1994 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
@@ -0,0 +1,378 @@
/***
*heapchk.c - perform a consistency check on the heap
*
* Copyright (c) 1989-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the _heapchk() and _heapset() functions
*
*******************************************************************************/
#ifdef WINHEAP
#include <cruntime.h>
#include <windows.h>
#include <errno.h>
#include <malloc.h>
#include <mtdll.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <winheap.h>
/***
*int _heapchk() - Validate the heap
*int _heapset(_fill) - Obsolete function!
*
*Purpose:
* Both functions perform a consistency check on the heap. The old
* _heapset used to fill free blocks with _fill, in addition to
* performing the consistency check. The current _heapset ignores the
* passed parameter and just returns _heapchk.
*
*Entry:
* For heapchk()
* No arguments
* For heapset()
* int _fill - ignored
*
*Exit:
* Returns one of the following values:
*
* _HEAPOK - completed okay
* _HEAPEMPTY - heap not initialized
* _HEAPBADBEGIN - can't find initial header info
* _HEAPBADNODE - malformed node somewhere
*
* Debug version prints out a diagnostic message if an error is found
* (see errmsg[] above).
*
* NOTE: Add code to support memory regions.
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
int __cdecl _heapchk (void)
{
int retcode = _HEAPOK;
if ( __active_heap == __V6_HEAP )
{
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
if ( __sbh_heap_check() < 0 )
retcode = _HEAPBADNODE;
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
}
else if ( __active_heap == __V5_HEAP )
{
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
if ( __old_sbh_heap_check() < 0 )
retcode = _HEAPBADNODE;
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
}
if (!HeapValidate(_crtheap, 0, NULL))
{
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
_doserrno = ERROR_CALL_NOT_IMPLEMENTED;
errno = ENOSYS;
}
else
retcode = _HEAPBADNODE;
}
return retcode;
}
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
int __cdecl _heapset (
unsigned int _fill
)
{
return _heapchk();
}
#else /* WINHEAP */
#include <cruntime.h>
#include <heap.h>
#include <malloc.h>
#include <mtdll.h>
#include <stddef.h>
#include <string.h>
static int __cdecl _heap_checkset(unsigned int _fill);
/* Debug error values */
#define _EMPTYHEAP 0
#define _BADROVER 1
#define _BADRANGE 2
#define _BADSENTINEL 3
#define _BADEMPTY 4
#define _EMPTYLOOP 5
#define _BADFREE 6
#define _BADORDER 7
#define _PRINTERR(msg)
/***
*int _heapchk() - Validate the heap
*int _heapset(_fill) - Validate the heap and fill in free entries
*
*Purpose:
* Performs a consistency check on the heap.
*
*Entry:
* For heapchk()
* No arguments
* For heapset()
* int _fill - value to be used as filler in free entries
*
*Exit:
* Returns one of the following values:
*
* _HEAPOK - completed okay
* _HEAPEMPTY - heap not initialized
* _HEAPBADBEGIN - can't find initial header info
* _HEAPBADNODE - malformed node somewhere
*
* Debug version prints out a diagnostic message if an error is found
* (see errmsg[] above).
*
* NOTE: Add code to support memory regions.
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
int __cdecl _heapchk(void)
{
return(_heap_checkset((unsigned int)_HEAP_NOFILL));
}
int __cdecl _heapset (
unsigned int _fill
)
{
return(_heap_checkset(_fill));
}
/***
*static int _heap_checkset(_fill) - check the heap and fill in the
* free entries
*
*Purpose:
* Workhorse routine for both _heapchk() and _heapset().
*
*Entry:
* int _fill - either _HEAP_NOFILL or a value to be used as filler in
* free entries
*
*Exit:
* See description of _heapchk()/_heapset()
*
*******************************************************************************/
static int __cdecl _heap_checkset (
unsigned int _fill
)
{
REG1 _PBLKDESC pdesc;
REG2 _PBLKDESC pnext;
int roverfound=0;
int retval = _HEAPOK;
/*
* lock the heap
*/
_mlock(_HEAP_LOCK);
/*
* Validate the sentinel
*/
if (_heap_desc.sentinel.pnextdesc != NULL) {
_PRINTERR(_BADSENTINEL);
retval = _HEAPBADNODE;
goto done;
}
/*
* Test for an empty heap
*/
if ( (_heap_desc.pfirstdesc == &_heap_desc.sentinel) &&
(_heap_desc.proverdesc == &_heap_desc.sentinel) ) {
retval = _HEAPEMPTY;
goto done;
}
/*
* Get and validate the first descriptor
*/
if ((pdesc = _heap_desc.pfirstdesc) == NULL) {
_PRINTERR(_EMPTYHEAP);
retval = _HEAPBADBEGIN;
goto done;
}
/*
* Walk the heap descriptor list
*/
while (pdesc != &_heap_desc.sentinel) {
/*
* Make sure address for this entry is in range.
*/
if ( (_ADDRESS(pdesc) < _ADDRESS(_heap_desc.pfirstdesc)) ||
(_ADDRESS(pdesc) > _heap_desc.sentinel.pblock) ) {
_PRINTERR(_BADRANGE);
retval = _HEAPBADNODE;
goto done;
}
pnext = pdesc->pnextdesc;
/*
* Make sure the blocks corresponding to pdesc and pnext are
* in proper order.
*/
if ( _ADDRESS(pdesc) >= _ADDRESS(pnext) ) {
_PRINTERR(_BADORDER);
retval = _HEAPBADNODE;
goto done;
}
/*
* Check the backpointer.
*/
if (_IS_INUSE(pdesc) || _IS_FREE(pdesc)) {
if (!_CHECK_PDESC(pdesc)) {
retval = _HEAPBADPTR;
goto done;
}
}
/*
* Check for proverdesc
*/
if (pdesc == _heap_desc.proverdesc)
roverfound++;
/*
* If it is free, fill it in if appropriate
*/
if ( _IS_FREE(pdesc) && (_fill != _HEAP_NOFILL) )
memset( (void *)((unsigned)_ADDRESS(pdesc)+_HDRSIZE),
_fill, _BLKSIZE(pdesc) );
/*
* Onto the next block
*/
pdesc = pnext;
}
/*
* Make sure we found 1 and only 1 rover
*/
if (_heap_desc.proverdesc == &_heap_desc.sentinel)
roverfound++;
if (roverfound != 1) {
_PRINTERR(_BADROVER);
retval = _HEAPBADBEGIN;
goto done;
}
/*
* Walk the empty list. We can't really compare values against
* anything but we may loop forever or may cause a fault.
*/
pdesc = _heap_desc.emptylist;
while (pdesc != NULL) {
pnext = pdesc->pnextdesc;
/*
* Header should only appear once
*/
if (pnext == _heap_desc.emptylist) {
_PRINTERR(_EMPTYLOOP)
retval = _HEAPBADPTR;
goto done;
}
pdesc = pnext;
}
/*
* Common return
*/
done:
/*
* release the heap lock
*/
_munlock(_HEAP_LOCK);
return(retval);
}
#endif /* WINHEAP */
@@ -0,0 +1,789 @@
/***
*heapinit.c - Initialze the heap
*
* Copyright (c) 1989-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
*
*******************************************************************************/
#ifdef WINHEAP
#include <cruntime.h>
#include <malloc.h>
#include <stdlib.h>
#include <winheap.h>
HANDLE _crtheap;
/*
* Dummy definition of _amblksiz. Included primarily so the dll will build
* without having to change crtlib.c (there is an access function for _amblksiz
* defined in crtlib.c).
*/
unsigned int _amblksiz = BYTES_PER_PARA;
int __active_heap;
void __cdecl _GetLinkerVersion(LinkerVersion * plv)
{
PIMAGE_DOS_HEADER pidh;
PIMAGE_NT_HEADERS pinh;
plv->dw = 0;
pidh = (PIMAGE_DOS_HEADER) GetModuleHandle(NULL);
if ( pidh->e_magic != IMAGE_DOS_SIGNATURE || pidh->e_lfanew == 0)
return;
pinh = (PIMAGE_NT_HEADERS)(((PBYTE)pidh) + pidh->e_lfanew);
plv->bverMajor = pinh->OptionalHeader.MajorLinkerVersion;
plv->bverMinor = pinh->OptionalHeader.MinorLinkerVersion;
}
/***
*__heap_select() - Choose from the V6, V5 or system heaps
*
*Purpose:
* Check OS, environment and build bits to determine appropriate
* small-block heap for the app.
*
*Entry:
* <void>
*Exit:
* Returns __V6_HEAP, __V5_HEAP or __SYSTEM_HEAP
*
*Exceptions:
* none
*
*******************************************************************************/
int __cdecl __heap_select(void)
{
char env_heap_select_string[(_MAX_PATH+5)*16];
char env_app_name[_MAX_PATH];
char *env_heap_type = NULL;
char *cp;
int heap_choice;
LinkerVersion lv;
OSVERSIONINFO osvi;
// First, check the OS for NT >= 5.0
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
if ( GetVersionEx(&osvi) )
if ( (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) &&
(osvi.dwMajorVersion >= 5) )
return __SYSTEM_HEAP;
// Second, check the envrionment variable override
if (GetEnvironmentVariableA(__HEAP_ENV_STRING, env_heap_select_string, sizeof(env_heap_select_string)))
{
for (cp = env_heap_select_string; *cp; ++cp)
if ('a' <= *cp && *cp <= 'z')
*cp += 'A' - 'a';
if (!strncmp(__GLOBAL_HEAP_SELECTOR,env_heap_select_string,sizeof(__GLOBAL_HEAP_SELECTOR)-1))
env_heap_type = env_heap_select_string;
else
{
GetModuleFileName(NULL,env_app_name,sizeof(env_app_name));
for (cp = env_app_name; *cp; ++cp)
if ('a' <= *cp && *cp <= 'z')
*cp += 'A' - 'a';
env_heap_type = strstr(env_heap_select_string,env_app_name);
}
if (env_heap_type)
{
if (env_heap_type = strchr(env_heap_type,','))
{
cp = ++env_heap_type;
while (*cp)
{
if (*cp == ';')
*cp = 0;
else cp++;
}
heap_choice = (int)strtol(env_heap_type, NULL, 10);
if ( (heap_choice == __V5_HEAP) ||
(heap_choice == __V6_HEAP) ||
(heap_choice == __SYSTEM_HEAP) )
return heap_choice;
}
}
}
// Third, check the build bits in the app; apps built with tools >= VC++ 6.0
// will get the V6 heap, apps built with older tools will get the V5 heap
_GetLinkerVersion(&lv);
if (lv.bverMajor >= 6)
return __V6_HEAP;
else
return __V5_HEAP;
}
/***
*_heap_init() - Initialize the heap
*
*Purpose:
* Setup the initial C library heap.
*
* NOTES:
* (1) This routine should only be called once!
* (2) This routine must be called before any other heap requests.
*
*Entry:
* <void>
*Exit:
* Returns 1 if successful, 0 otherwise.
*
*Exceptions:
* If heap cannot be initialized, the program will be terminated
* with a fatal runtime error.
*
*******************************************************************************/
int __cdecl _heap_init (
int mtflag
)
{
// Initialize the "big-block" heap first.
if ( (_crtheap = HeapCreate( mtflag ? 0 : HEAP_NO_SERIALIZE,
BYTES_PER_PAGE, 0 )) == NULL )
return 0;
// Pick a heap, any heap
__active_heap = __heap_select();
if ( __active_heap == __V6_HEAP )
{
// Initialize the small-block heap
if (__sbh_heap_init(MAX_ALLOC_DATA_SIZE) == 0)
{
HeapDestroy(_crtheap);
return 0;
}
}
else if ( __active_heap == __V5_HEAP )
{
if ( __old_sbh_new_region() == NULL )
{
HeapDestroy( _crtheap );
return 0;
}
}
return 1;
}
/***
*_heap_term() - return the heap to the OS
*
*Purpose:
*
* NOTES:
* (1) This routine should only be called once!
* (2) This routine must be called AFTER any other heap requests.
*
*Entry:
* <void>
*Exit:
* <void>
*
*Exceptions:
*
*******************************************************************************/
void __cdecl _heap_term (void)
{
// if it has been initialized, destroy the small-block heap
if ( __active_heap == __V6_HEAP )
{
PHEADER pHeader = __sbh_pHeaderList;
int cntHeader;
// scan through all the headers
for (cntHeader = 0; cntHeader < __sbh_cntHeaderList; cntHeader++)
{
// decommit and release the address space for the region
VirtualFree(pHeader->pHeapData, BYTES_PER_REGION, MEM_DECOMMIT);
VirtualFree(pHeader->pHeapData, 0, MEM_RELEASE);
// free the region data structure
HeapFree(_crtheap, 0, pHeader->pRegion);
pHeader++;
}
// free the header list
HeapFree(_crtheap, 0, __sbh_pHeaderList);
}
else if ( __active_heap == __V5_HEAP )
{
__old_sbh_region_t *preg = &__old_small_block_heap;
// Release the regions of the small-block heap
do
{
if ( preg->p_pages_begin != NULL )
VirtualFree( preg->p_pages_begin, 0, MEM_RELEASE );
}
while ( (preg = preg->p_next_region) != &__old_small_block_heap );
}
// destroy the large-block heap
HeapDestroy(_crtheap);
}
#else /* WINHEAP */
#ifdef _WIN32
#include <cruntime.h>
#include <oscalls.h>
#include <dos.h>
#include <heap.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
/*
* Heap descriptor
*/
struct _heap_desc_ _heap_desc = {
&_heap_desc.sentinel, /* pfirstdesc */
&_heap_desc.sentinel, /* proverdesc */
NULL, /* emptylist */
NULL, /* sentinel.pnextdesc */
NULL /* sentinel.pblock */
};
/*
* Array of region structures
* [Note: We count on the fact that this is always initialized to zero
* by the compiler.]
*/
struct _heap_region_ _heap_regions[_HEAP_REGIONMAX];
void ** _heap_descpages; /* linked list of pages used for descriptors */
/*
* Control parameter locations
*/
unsigned int _heap_resetsize = 0xffffffff;
/* NOTE: Currenlty, _heap_growsize is a #define to _amblksiz */
unsigned int _heap_growsize = _HEAP_GROWSIZE; /* region inc size */
unsigned int _heap_regionsize = _HEAP_REGIONSIZE_L; /* region size */
unsigned int _heap_maxregsize = _HEAP_MAXREGSIZE_L; /* max region size */
/***
*_heap_init() - Initialize the heap
*
*Purpose:
* Setup the initial C library heap. All necessary memory and
* data bases are init'd appropriately so future requests work
* correctly.
*
* NOTES:
* (1) This routine should only be called once!
* (2) This routine must be called before any other heap requests.
*
*
*Entry:
* <void>
*Exit:
* <void>
*
*Exceptions:
* If heap cannot be initialized, the program will be terminated
* with a fatal runtime error.
*
*******************************************************************************/
void __cdecl _heap_init (
void
)
{
/*
* Test for Win32S or Phar Lap TNT environment
* which cannot allocate uncommitted memory
* without actually allocating physical memory
*
* High bit of _osver is set for both of those environments
* -AND- the Windows version will be less than 4.0.
*/
if ( ( _osver & 0x8000 ) && ( _winmajor < 4 ) )
{
_heap_regionsize = _HEAP_REGIONSIZE_S;
_heap_maxregsize = _HEAP_MAXREGSIZE_S;
}
}
/***
*_heap_term() - Clean-up the heap
*
*Purpose:
* This routine will decommit and release ALL of the CRT heap.
* All memory malloc-ed by the CRT will then be invalid.
*
* NOTES:
* (1) This routine should only be called once!
* (2) This routine must be called AFTER any other heap requests.
*
*Entry:
* <void>
*Exit:
* <void>
*
*Exceptions:
*
*******************************************************************************/
void __cdecl _heap_term (
void
)
{
int index;
void **pageptr;
/*
* Loop through the region descriptor table, decommitting
* and releasing (freeing up) each region that is in use.
*/
for ( index=0 ; index < _HEAP_REGIONMAX ; index++ ) {
void * regbase ;
if ( (regbase = _heap_regions[index]._regbase)
&& VirtualFree(regbase, _heap_regions[index]._currsize, MEM_DECOMMIT)
&& VirtualFree(regbase, 0, MEM_RELEASE) )
regbase = _heap_regions[index]._regbase = NULL ;
}
/*
* Now we need to decommit and release the pages used for descriptors
* _heap_descpages points to the head of a singly-linked list of the pages.
*/
pageptr = _heap_descpages;
while ( pageptr ) {
void **nextpage;
nextpage = *pageptr;
if(!VirtualFree(pageptr, 0, MEM_RELEASE))
break; /* if the linked list is corrupted, give up */
pageptr = nextpage;
}
}
/***
* _heap_grow_emptylist() - Grow the empty heap descriptor list
*
*Purpose:
* (1) Get memory from OS
* (2) Form it into a linked list of empty heap descriptors
* (3) Attach it to the master empty list
*
* NOTE: This routine assumes that the emptylist is NULL
* when called (i.e., there are no available empty heap descriptors).
*
*Entry:
* (void)
*
*Exit:
* 1, if the empty heap descriptor list was grown
* 0, if the empty heap descriptor list could not be grown.
*
*Exceptions:
*
*******************************************************************************/
static int __cdecl _heap_grow_emptylist (
void
)
{
REG1 _PBLKDESC first;
REG2 _PBLKDESC next;
_PBLKDESC last;
/*
* Get memory for the new empty heap descriptors
*
* Note that last is used to hold the returned pointer because
* first (and next) are register class.
*/
if ( !(last = VirtualAlloc(NULL,
_HEAP_EMPTYLIST_SIZE,
MEM_COMMIT,
PAGE_READWRITE)) )
return 0;
/*
* Add this descriptor block to the front of the list
*
* Advance "last" to skip over the
*/
*(void **)last = _heap_descpages;
_heap_descpages = (void **)(last++);
/*
* Init the empty heap descriptor list.
*/
_heap_desc.emptylist = first = last;
/*
* Carve the memory into an empty list
*/
last = (_PBLKDESC) ((char *) first + _HEAP_EMPTYLIST_SIZE - 2 * sizeof(_BLKDESC));
next = (_PBLKDESC) ((char *) first + sizeof(_BLKDESC));
while ( first < last ) {
/* Init this descriptor */
first->pnextdesc = next;
/* onto the next block */
first = next++;
}
/*
* Take care of the last descriptor (end of the empty list)
*/
last->pnextdesc = NULL;
return 1;
}
/***
*__getempty() - get an empty heap descriptor
*
*Purpose:
* Get a descriptor from the list of empty heap descriptors. If the list
* is empty, call _heap_grow_emptylist.
*
*Entry:
* no arguments
*
*Exit:
* If successful, a pointer to the descriptor is returned.
* Otherwise, NULL is returned.
*
*Exceptions:
*
*******************************************************************************/
_PBLKDESC __cdecl __getempty(
void
)
{
_PBLKDESC pdesc;
if ( (_heap_desc.emptylist == NULL) && (_heap_grow_emptylist()
== 0) )
return NULL;
pdesc = _heap_desc.emptylist;
_heap_desc.emptylist = pdesc->pnextdesc;
return pdesc;
}
#else /* _WIN32 */
#if defined (_M_MPPC) || defined (_M_M68K)
#include <cruntime.h>
#include <dos.h>
#include <heap.h>
#include <malloc.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <dbgint.h>
#include <macos\types.h>
#include <macos\errors.h>
#include <macos\memory.h> // Mac OS interface header
#include <macos\lowmem.h>
#include <macos\segload.h>
#define _HEAP_EMPTYLIST_SIZE (1 * _PAGESIZE_)
#define DSErrCode (*(short*)(0x0af0))
/*
* Heap descriptor
*/
struct _heap_desc_ _heap_desc = {
&_heap_desc.sentinel, /* pfirstdesc */
&_heap_desc.sentinel, /* proverdesc */
NULL, /* emptylist */
NULL, /* sentinel.pnextdesc */
NULL /* sentinel.pblock */
};
/*
* Array of region structures
* [Note: We count on the fact that this is always initialized to zero
* by the compiler.]
*/
Handle hHeapRegions = NULL;
int _heap_region_table_cur = 0;
/*
* Control parameter locations
*/
unsigned int _heap_resetsize = 0xffffffff;
/* NOTE: Currenlty, _heap_growsize is a #define to _amblksiz */
unsigned int _heap_growsize = _HEAP_GROWSIZE; /* region inc size */
unsigned int _heap_regionsize = _HEAP_REGIONSIZE; /* region size */
/***
*_heap_init() - Initialize the heap
*
*Purpose:
* Setup the initial C library heap. All necessary memory and
* data bases are init'd appropriately so future requests work
* correctly.
*
* NOTES:
* (1) This routine should only be called once!
* (2) This routine must be called before any other heap requests.
*
*
*Entry:
* <void>
*Exit:
* <void>
*
*Exceptions:
* If heap cannot be initialized, the program will be terminated
* with a fatal runtime error.
*
*******************************************************************************/
void __cdecl _heap_init (
void
)
{
#define _INITREGIONSZ 0x1000
/*LATER -- do we need to do anything to init heap? Yes, in case user not malloc first*/
int oldregionsz = _heap_regionsize; /* save current region size */
struct _heap_region_ *pHeapRegions;
void *p;
void *p2;
if (hHeapRegions == NULL)
{
hHeapRegions = NewHandle(sizeof(struct _heap_region_)*_HEAP_REGIONMAX);
if (hHeapRegions == NULL)
{
DSErrCode = appMemFullErr;
ExitToShell();
}
HLock(hHeapRegions);
pHeapRegions = (struct _heap_region_ *)(*hHeapRegions);
memset(pHeapRegions, 0, sizeof(struct _heap_region_)*_HEAP_REGIONMAX);
_heap_region_table_cur = _HEAP_REGIONMAX;
}
_heap_regionsize = _INITREGIONSZ; /* set region size to 64 Kb */
/* make sure we have enough memory to do initialization */
if ((p = NewPtr(_HEAP_EMPTYLIST_SIZE)) == NULL)
{
DSErrCode = appMemFullErr;
ExitToShell();
}
if ((p2 = NewPtr(_heap_regionsize)) == NULL)
{
DSErrCode = appMemFullErr;
ExitToShell();
}
if (p)
{
DisposePtr(p);
}
if (p2)
{
DisposePtr(p2);
}
p = _malloc_base(4);
if (p == NULL)
{
DSErrCode = appMemFullErr;
ExitToShell();
}
_free_base( p ); /* malloc, then free a block */
_heap_regionsize = oldregionsz; /* restore region size */
}
/***
* _heap_grow_emptylist() - Grow the empty heap descriptor list
*
*Purpose:
* (1) Get memory from OS
* (2) Form it into a linked list of empty heap descriptors
* (3) Attach it to the master empty list
*
* NOTE: This routine assumes that the emptylist is NULL
* when called (i.e., there are no available empty heap descriptors).
*
*Entry:
* (void)
*
*Exit:
* (void)
*
*Exceptions:
*
*******************************************************************************/
static int __cdecl _heap_grow_emptylist (
void
)
{
REG1 _PBLKDESC first;
REG2 _PBLKDESC next;
_PBLKDESC last;
/*
* Get memory for the new empty heap descriptors
*
* Note that last is used to hold the returned pointer because
* first (and next) are register class.
*/
if ((last = (_PBLKDESC)NewPtr(_HEAP_EMPTYLIST_SIZE)) == NULL)
{
return 0;
}
/*
* Init the empty heap descriptor list.
*/
_heap_desc.emptylist = first = last;
/*
* Carve the memory into an empty list
*/
last = (_PBLKDESC) ((char *) first + _HEAP_EMPTYLIST_SIZE - sizeof(_BLKDESC));
next = (_PBLKDESC) ((char *) first + sizeof(_BLKDESC));
while ( first < last ) {
/* Init this descriptor */
first->pnextdesc = next;
/* onto the next block */
first = next++;
}
/*
* Take care of the last descriptor (end of the empty list)
*/
last->pnextdesc = NULL;
return 1;
}
/***
*__getempty() - get an empty heap descriptor
*
*Purpose:
* Get a descriptor from the list of empty heap descriptors. If the list
* is empty, call _heap_grow_emptylist.
*
*Entry:
* no arguments
*
*Exit:
* If successful, a pointer to the descriptor is returned.
* Otherwise, NULL is returned.
*
*Exceptions:
*
*******************************************************************************/
_PBLKDESC __cdecl __getempty(
void
)
{
_PBLKDESC pdesc;
if ( (_heap_desc.emptylist == NULL) && (_heap_grow_emptylist()
== 0) )
return NULL;
pdesc = _heap_desc.emptylist;
_heap_desc.emptylist = pdesc->pnextdesc;
return pdesc;
}
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
#endif /* _WIN32 */
#endif /* WINHEAP */
@@ -0,0 +1,535 @@
/***
*heapmin.c - Minimize the heap
*
* Copyright (c) 1989-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Minimize the heap freeing as much memory as possible back
* to the OS.
*
*******************************************************************************/
#ifdef WINHEAP
#include <cruntime.h>
#include <windows.h>
#include <errno.h>
#include <malloc.h>
#include <mtdll.h>
#include <stdlib.h>
#include <winheap.h>
/***
*_heapmin() - Minimize the heap
*
*Purpose:
* Minimize the heap freeing as much memory as possible back
* to the OS.
*
*Entry:
* (void)
*
*Exit:
*
* 0 = no error has occurred
* -1 = an error has occurred (errno is set)
*
*Exceptions:
*
*******************************************************************************/
int __cdecl _heapmin(void)
{
if ( __active_heap == __V6_HEAP ) {
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
__sbh_heapmin();
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
}
else if ( __active_heap == __V5_HEAP ) {
/*
* Minimize the small-block heap by calling _sbh_decommit_pages()
* with a big enough count to ensure every page which can be
* decommitted, is.
*/
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
__old_sbh_decommit_pages( 2 * _OLD_PAGES_PER_COMMITMENT );
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
}
if ( HeapCompact( _crtheap, 0 ) == 0 ) {
if ( GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) {
_doserrno = ERROR_CALL_NOT_IMPLEMENTED;
errno = ENOSYS;
}
return -1;
}
else {
return 0;
}
}
#else /* WINHEAP */
#include <cruntime.h>
#include <heap.h>
#include <malloc.h>
#include <mtdll.h>
#include <stdlib.h>
#if defined (_M_MPPC) || defined (_M_M68K)
#include <macos\memory.h> // Mac OS interface header
#else /* defined (_M_MPPC) || defined (_M_M68K) */
#include <windows.h>
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
static int __cdecl _heapmin_region(int, void *, _PBLKDESC);
static void __cdecl _free_partial_region(_PBLKDESC, unsigned, int);
#if defined (_M_MPPC) || defined (_M_M68K)
extern Handle hHeapRegions;
extern int _heap_region_table_cur;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/***
*_heapmin() - Minimize the heap
*
*Purpose:
* Minimize the heap freeing as much memory as possible back
* to the OS.
*
*Entry:
* (void)
*
*Exit:
* 0 = no error has occurred
* -1 = an error has occurred (errno is set)
*
*Exceptions:
*
*******************************************************************************/
int __cdecl _heapmin(void)
{
REG1 int index;
_PBLKDESC pdesc;
REG2 _PBLKDESC pdesc2;
void * regend;
int region_min_count = 0;
#if defined (_M_MPPC) || defined (_M_M68K)
struct _heap_region_ *pHeapRegions;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/*
* Lock the heap
*/
_mlock(_HEAP_LOCK);
/*
* Coalesce the heap (should return NULL)
*/
if ( _heap_search((unsigned)_HEAP_COALESCE) != NULL )
_heap_abort();
/*
* Loop through the region descriptor table freeing as much
* memory to the OS as possible.
*/
#if defined (_M_MPPC) || defined (_M_M68K)
for ( index=0 ; index < _heap_region_table_cur ; index++ ) {
pHeapRegions = (struct _heap_region_ *)(*hHeapRegions);
if ( (pHeapRegions + index)->_regbase == NULL )
continue; /* region entry is empty */
/*
* Get the entry that contains the last address of
* the region (allocated so far, that is).
*/
regend = (char *) ( (pHeapRegions + index)->_regbase) +
(pHeapRegions + index)->_currsize - 1;
#else /* defined (_M_MPPC) || defined (_M_M68K) */
for ( index=0 ; index < _HEAP_REGIONMAX ; index++ ) {
if ( _heap_regions[index]._regbase == NULL )
continue; /* region entry is empty */
/*
* Get the entry that contains the last address of
* the region (allocated so far, that is).
*/
regend = (char *) _heap_regions[index]._regbase +
_heap_regions[index]._currsize - 1;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
if ( _heap_findaddr(regend, &pdesc) != _HEAPFIND_WITHIN )
_heap_abort(); /* last address not within a block */
/*
* See if the containing block is free
*/
if ( !(_IS_FREE(pdesc)) )
continue; /* block is not free */
/*
* Region ends with a free block, go free as much mem
* as possible.
*/
region_min_count += _heapmin_region(index, regend, pdesc);
} /* region loop */
/*
* By minimizing the heap, we've likely invalidated the rover and
* may have produced contiguous dummy blocks so:
*
* (1) reset the rover
* (2) coalesce contiguous dummy blocks
*/
if ( region_min_count ) {
/*
* Set proverdesc to pfirstdesc
*/
_heap_desc.proverdesc = _heap_desc.pfirstdesc;
for ( pdesc = _heap_desc.pfirstdesc ; pdesc !=
&_heap_desc.sentinel ; pdesc = pdesc->pnextdesc ) {
/*
* Check and remove consecutive dummy blocks
*/
if ( _IS_DUMMY(pdesc) ) {
for ( pdesc2 = pdesc->pnextdesc ;
_IS_DUMMY(pdesc2) ;
pdesc2 = pdesc->pnextdesc ) {
/*
* coalesce the dummy blocks
*/
pdesc->pnextdesc = pdesc2->pnextdesc;
_PUTEMPTY(pdesc2);
} /* dummy loop */
} /* if */
} /* heap loop */
} /* region_min_count */
/*
* Good return
*/
/* goodrtn: unreferenced label to be removed */
/*
* Release the heap lock
*/
_munlock(_HEAP_LOCK);
return(0);
}
/***
*_heapmin_region() - Minimize a region
*
*Purpose:
* Free as much of a region back to the OS as possible.
*
*Entry:
* int index = index of the region in the region table
* void * regend = last valid address in region
* pdesc = pointer to the last block of memory in the region
* (it has already been determined that this block is free)
*
*Exit:
* int 1 = minimized region
* 0 = no change to region
*
*Exceptions:
*
*******************************************************************************/
static int __cdecl _heapmin_region (
int index,
void * regend,
REG1 _PBLKDESC pdesc
)
{
unsigned size;
REG2 _PBLKDESC pnew;
#if defined (_M_MPPC) || defined (_M_M68K)
struct _heap_region_ *pHeapRegions;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/*
* Init some variables
*
* regend = 1st address AFTER region
* size = amount of free memory at end of current region
*/
regend = (char *) regend + 1; /* "regend++" give compiler error... */
size = ((char *)regend - (char *)_ADDRESS(pdesc));
/*
* See if there's enough free memory to release to the OS.
* (NOTE: Need more than a page since we may need a back pointer.)
*/
if ( size <= _PAGESIZE_ )
return(0); /* 0 = no change to region */
/*
* We're going to free some memory to the OS. See if the
* free block crosses the end of the region and, if so,
* split up the block appropriately.
*/
if ( (_MEMSIZE(pdesc) - size) != 0 ) {
/*
* The free block spans the end of the region.
* Divide it up.
*/
/*
* Get an empty descriptor
*/
if ( (pnew = __getempty()) == NULL )
return(0);
pnew->pblock = regend; /* init block pointer */
* (_PBLKDESC*)regend = pnew; /* init back pointer */
_SET_FREE(pnew); /* set the block free */
pnew->pnextdesc = pdesc->pnextdesc; /* link it in */
pdesc->pnextdesc = pnew;
}
/*
* At this point, we have a free block of memory that goes
* up to (but not exceeding) the end of the region.
*
* pdesc = descriptor of the last free block in region
* size = amount of free mem at end of region (i.e., _MEMSIZE(pdesc))
* regend = 1st address AFTER end of region
*/
/*
* See if we should return the whole region of only part of it.
*/
#if defined (_M_MPPC) || defined (_M_M68K)
pHeapRegions = (struct _heap_region_ *)(*hHeapRegions);
if ( _ADDRESS(pdesc) == (pHeapRegions + index)->_regbase ) {
#else /* defined (_M_MPPC) || defined (_M_M68K) */
if ( _ADDRESS(pdesc) == _heap_regions[index]._regbase ) {
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/*
* Whole region is free, return it to OS
*/
_heap_free_region(index);
/*
* Put a dummy block in the heap to hold space for
* the memory we just freed up.
*/
_SET_DUMMY(pdesc);
}
else {
/*
* Whole region is NOT free, return part of it to OS
*/
#if !defined (_M_MPPC) && !defined (_M_M68K)
_free_partial_region(pdesc, size, index);
#endif /* !defined (_M_MPPC) && !defined (_M_M68K) */
}
/*
* Exit paths
*/
return(1); /* 1 = minimized region */
}
/***
*_free_partial_region() - Free part of a region to the OS
*
*Purpose:
* Free a portion of a region to the OS
*
*Entry:
* pdesc = descriptor of last free block in region
* size = amount of free mem at end of region (i.e., _MEMSIZE(pdesc))
* index = index of region
*
*Exit:
*
*Exceptions:
*
*******************************************************************************/
static void __cdecl _free_partial_region (
REG1 _PBLKDESC pdesc,
unsigned size,
int index
)
{
unsigned left;
void * base;
REG2 _PBLKDESC pnew;
#if defined (_M_MPPC) || defined (_M_M68K)
struct _heap_region_ *pHeapRegions;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/*
* Init a few variables.
*/
left = (size & (_PAGESIZE_-1));
base = (char *)_ADDRESS(pdesc);
/*
* We return memory to the OS in page multiples. If the
* free block is not page aligned, we'll insert a new free block
* to fill in the difference.
*/
if ( left != 0 ) {
/*
* The block is not a multiple of pages so we need
* to adjust variables accordingly.
*/
size -= left;
base = (char *)base + left;
}
/*
* Return the free pages to the OS.
*/
#if defined (_M_MPPC) || defined (_M_M68K)
if (base)
{
DisposePtr(base);
}
/*
* Adjust the region table entry
*/
pHeapRegions = (struct _heap_region_ *)(*hHeapRegions);
(pHeapRegions + index)->_currsize -= size;
#else /* defined (_M_MPPC) || defined (_M_M68K) */
if (!VirtualFree(base, size, MEM_DECOMMIT))
_heap_abort();
/*
* Adjust the region table entry
*/
_heap_regions[index]._currsize -= size;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/*
* Adjust the heap according to whether we released the whole
* free block or not. (Don't worry about consecutive dummies,
* we'll coalesce them later.)
*
* base = address of block we just gave back to OS
* size = size of block we gave back to OS
* left = size of block we did NOT give back to OS
*/
if ( left == 0 ) {
/*
* The free block was released to the OS in its
* entirety. Make the free block a dummy place holder.
*/
_SET_DUMMY(pdesc);
}
else {
/*
* Did NOT release the whole free block to the OS.
* There's a block of free memory we want to leave
* in the heap. Insert a dummy entry after it.
*/
if ( (pnew = __getempty()) == NULL )
_heap_abort();
pnew->pblock = (char *)base;
_SET_DUMMY(pnew);
pnew->pnextdesc = pdesc->pnextdesc;
pdesc->pnextdesc = pnew;
}
}
#endif /* WINHEAP */
@@ -0,0 +1,313 @@
/***
*malloc.c - Get a block of memory from the heap
*
* Copyright (c) 1989-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the malloc() function.
*
*******************************************************************************/
#include <cruntime.h>
#include <malloc.h>
#include <internal.h>
#include <mtdll.h>
#include <dbgint.h>
#ifdef WINHEAP
#include <windows.h>
#include <winheap.h>
#else /* WINHEAP */
#include <heap.h>
#endif /* WINHEAP */
extern int _newmode; /* malloc new() handler mode */
/***
*void *malloc(size_t size) - Get a block of memory from the heap
*
*Purpose:
* Allocate of block of memory of at least size bytes from the heap and
* return a pointer to it.
*
* Calls the new appropriate new handler (if installed).
*
*Entry:
* size_t size - size of block requested
*
*Exit:
* Success: Pointer to memory block
* Failure: NULL (or some error value)
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
void * __cdecl _malloc_base (size_t size)
{
void *res = _nh_malloc_base(size, _newmode);
return res;
}
/***
*void *_nh_malloc_base(size_t size) - Get a block of memory from the heap
*
*Purpose:
* Allocate of block of memory of at least size bytes from the heap and
* return a pointer to it.
*
* Calls the appropriate new handler (if installed).
*
* There are two distinct new handler schemes supported. The 'new' ANSI
* C++ scheme overrides the 'old' scheme when it is activated. A value of
* _NOPTH for the 'new' handler indicates that it is inactivated and the
* 'old' handler is then called.
*
*Entry:
* size_t size - size of block requested
*
*Exit:
* Success: Pointer to memory block
* Failure: NULL (or some error value)
*
*Uses:
*
*Exceptions:
*
*******************************************************************************/
void * __cdecl _nh_malloc_base (size_t size, int nhFlag)
{
void * pvReturn;
// validate size
if (size > _HEAP_MAXREQ)
return NULL;
#ifndef WINHEAP
/* round requested size */
size = _ROUND2(size, _GRANULARITY);
#endif /* WINHEAP */
for (;;) {
// allocate memory block
if (size <= _HEAP_MAXREQ)
pvReturn = _heap_alloc_base(size);
else
pvReturn = NULL;
// if successful allocation, return pointer to memory
// if new handling turned off altogether, return NULL
if (pvReturn || nhFlag == 0)
return pvReturn;
// call installed new handler
if (!_callnewh(size))
return NULL;
// new handler was successful -- try to allocate again
}
}
/***
*void *_heap_alloc_base(size_t size) - does actual allocation
*
*Purpose:
* Same as malloc() except the new handler is not called.
*
*Entry:
* See malloc
*
*Exit:
* See malloc
*
*Exceptions:
*
*******************************************************************************/
void * __cdecl _heap_alloc_base (size_t size)
{
#ifdef WINHEAP
void * pvReturn;
#else /* WINHEAP */
_PBLKDESC pdesc;
_PBLKDESC pdesc2;
#endif /* WINHEAP */
#ifdef WINHEAP
if ( __active_heap == __V6_HEAP )
{
if ( size <= __sbh_threshold )
{
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
pvReturn = __sbh_alloc_block(size);
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
if (pvReturn)
return pvReturn;
}
}
else if ( __active_heap == __V5_HEAP )
{
/* round up to the nearest paragraph */
if ( size )
size = (size + _OLD_PARASIZE - 1) & ~(_OLD_PARASIZE - 1);
else
size = _OLD_PARASIZE;
if ( size <= __old_sbh_threshold ) {
#ifdef _MT
_mlock(_HEAP_LOCK);
__try {
#endif /* _MT */
pvReturn = __old_sbh_alloc_block(size >> _OLD_PARASHIFT);
#ifdef _MT
}
__finally {
_munlock(_HEAP_LOCK);
}
#endif /* _MT */
if ( pvReturn != NULL )
return pvReturn;
}
return HeapAlloc( _crtheap, 0, size );
}
if (size == 0)
size = 1;
size = (size + BYTES_PER_PARA - 1) & ~(BYTES_PER_PARA - 1);
return HeapAlloc(_crtheap, 0, size);
}
#else /* WINHEAP */
/* try to find a big enough free block
*/
if ( (pdesc = _heap_search(size)) == NULL )
{
if ( _heap_grow(size) != -1 )
{
/* try finding a big enough free block again. the
* success of the call to _heap_grow should guarantee
* it, but...
*/
if ( (pdesc = _heap_search(size)) == NULL )
{
/* something unexpected, and very bad, has
* happened. abort!
*/
_heap_abort();
}
}
else
return NULL;
}
/* carve the block into two pieces (if necessary). the first piece
* shall be of the exact requested size, marked inuse and returned to
* the caller. the leftover piece is to be marked free.
*/
if ( _BLKSIZE(pdesc) != size ) {
/* split up the block and free the leftover piece back to
* the heap
*/
if ( (pdesc2 = _heap_split_block(pdesc, size)) != NULL )
_SET_FREE(pdesc2);
}
/* mark pdesc inuse
*/
_SET_INUSE(pdesc);
/* check proverdesc and reset, if necessary
*/
_heap_desc.proverdesc = pdesc->pnextdesc;
return( (void *)((char *)_ADDRESS(pdesc) + _HDRSIZE) );
}
/***
*_PBLKDESC _heap_split_block(pdesc, newsize) - split a heap allocation block
* into two allocation blocks
*
*Purpose:
* Split the allocation block described by pdesc into two blocks, the
* first one being of newsize bytes.
*
* Notes: It is caller's responsibilty to set the status (i.e., free
* or inuse) of the two new blocks, and to check and reset proverdesc
* if necessary. See Exceptions (below) for additional requirements.
*
*Entry:
* _PBLKDESC pdesc - pointer to the allocation block descriptor
* size_t newsize - size for the first of the two sub-blocks (i.e.,
* (i.e., newsize == _BLKSIZE(pdesc), on exit)
*
*Exit:
* If successful, return a pointer to the descriptor for the leftover
* block.
* Otherwise, return NULL.
*
*Exceptions:
* It is assumed pdesc points to a valid allocation block descriptor and
* newsize is a valid heap block size as is (i.e., WITHOUT rounding). If
* either of these of assumption is violated, _heap_split_block() will
* likely corrupt the heap. Note also that _heap_split_block will simply
* return to the caller if newsize >= _BLKSIZE(pdesc), on entry.
*
*******************************************************************************/
_PBLKDESC __cdecl _heap_split_block (
REG1 _PBLKDESC pdesc,
size_t newsize
)
{
REG2 _PBLKDESC pdesc2;
_ASSERTE(("_heap_split_block: bad pdesc arg", _CHECK_PDESC(pdesc)));
_ASSERTE(("_heap_split_block: bad newsize arg", _ROUND2(newsize,_GRANULARITY) == newsize));
/* carve the block into two pieces (if possible). the first piece
* is to be exactly newsize bytes.
*/
if ( (_BLKSIZE(pdesc) > newsize) && ((pdesc2 = __getempty())
!= NULL) )
{
/* set it up to manage the second piece and link it in to
* the list
*/
pdesc2->pblock = (void *)((char *)_ADDRESS(pdesc) + newsize +
_HDRSIZE);
*(void **)(pdesc2->pblock) = pdesc2;
pdesc2->pnextdesc = pdesc->pnextdesc;
pdesc->pnextdesc = pdesc2;
return pdesc2;
}
return NULL;
}
#endif /* WINHEAP */
@@ -0,0 +1,153 @@
/***
*msize.c - calculate the size of a memory block in the heap
*
* Copyright (c) 1989-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the following function:
* _msize() - calculate the size of a block in the heap
*
*******************************************************************************/
#ifdef WINHEAP
#include <cruntime.h>
#include <malloc.h>
#include <mtdll.h>
#include <winheap.h>
#include <windows.h>
#include <dbgint.h>
/***
*size_t _msize(pblock) - calculate the size of specified block in the heap
*
*Purpose:
* Calculates the size of memory block (in the heap) pointed to by
* pblock.
*
*Entry:
* void *pblock - pointer to a memory block in the heap
*
*Return:
* size of the block
*
*******************************************************************************/
size_t __cdecl _msize_base (void * pblock)
{
size_t retval;
PHEADER pHeader;
if ( __active_heap == __V6_HEAP )
{
#ifdef _MT
_mlock( _HEAP_LOCK );
__try {
#endif /* _MT */
if ((pHeader = __sbh_find_block(pblock)) != NULL)
retval = (size_t)
(((PENTRY)((char *)pblock - sizeof(int)))->sizeFront - 0x9);
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
if ( pHeader == NULL )
retval = (size_t)HeapSize(_crtheap, 0, pblock);
}
else if ( __active_heap == __V5_HEAP )
{
__old_sbh_region_t *preg;
__old_sbh_page_t * ppage;
__old_page_map_t * pmap;
#ifdef _MT
_mlock(_HEAP_LOCK);
__try {
#endif /* _MT */
if ( (pmap = __old_sbh_find_block(pblock, &preg, &ppage)) != NULL )
retval = ((size_t)(*pmap)) << _OLD_PARASHIFT;
#ifdef _MT
}
__finally {
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
if ( pmap == NULL )
retval = (size_t) HeapSize( _crtheap, 0, pblock );
}
else /* __active_heap == __SYSTEM_HEAP */
retval = (size_t)HeapSize(_crtheap, 0, pblock);
return retval;
}
#else /* WINHEAP */
#include <cruntime.h>
#include <heap.h>
#include <malloc.h>
#include <mtdll.h>
#include <stdlib.h>
#include <dbgint.h>
/***
*size_t _msize(pblock) - calculate the size of specified block in the heap
*
*Purpose:
* Calculates the size of memory block (in the heap) pointed to by
* pblock.
*
*Entry:
* void *pblock - pointer to a memory block in the heap
*
*Return:
* size of the block
*
*******************************************************************************/
#ifdef _MT
size_t __cdecl _msize_base (
void *pblock
)
{
size_t retval;
/* lock the heap
*/
_mlock(_HEAP_LOCK);
retval = _msize_lk(pblock);
/* release the heap lock
*/
_munlock(_HEAP_LOCK);
return retval;
}
size_t __cdecl _msize_lk (
#else /* _MT */
size_t __cdecl _msize_base (
#endif /* _MT */
void *pblock
)
{
return( (size_t) ((char *)_ADDRESS(_BACKPTR(pblock)->pnextdesc) -
(char *)pblock) );
}
#endif /* WINHEAP */
@@ -0,0 +1,28 @@
/***
*new.cxx - defines C++ new routine
*
* Copyright (c) 1990-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines C++ new routine.
*
*******************************************************************************/
#include <cruntime.h>
#include <malloc.h>
#include <new.h>
#include <stdlib.h>
#ifdef WINHEAP
#include <winheap.h>
#else /* WINHEAP */
#include <heap.h>
#endif /* WINHEAP */
void * operator new( unsigned int cb )
{
void *res = _nh_malloc( cb, 1 );
return res;
}
@@ -0,0 +1,653 @@
/***
*realloc.c - Reallocate a block of memory in the heap
*
* Copyright (c) 1989-1999, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines the realloc() and _expand() functions.
*
*******************************************************************************/
#ifdef WINHEAP
#include <cruntime.h>
#include <malloc.h>
#include <stdlib.h>
#include <string.h>
#include <winheap.h>
#include <windows.h>
#include <internal.h>
#include <mtdll.h>
#include <dbgint.h>
/***
*void *realloc(pblock, newsize) - reallocate a block of memory in the heap
*
*Purpose:
* Reallocates a block in the heap to newsize bytes. newsize may be
* either greater or less than the original size of the block. The
* reallocation may result in moving the block as well as changing
* the size. If the block is moved, the contents of the original block
* are copied over.
*
* Special ANSI Requirements:
*
* (1) realloc(NULL, newsize) is equivalent to malloc(newsize)
*
* (2) realloc(pblock, 0) is equivalent to free(pblock) (except that
* NULL is returned)
*
* (3) if the realloc() fails, the object pointed to by pblock is left
* unchanged
*
*Entry:
* void *pblock - pointer to block in the heap previously allocated
* by a call to malloc(), realloc() or _expand().
*
* size_t newsize - requested size for the re-allocated block
*
*Exit:
* Success: Pointer to the re-allocated memory block
* Failure: NULL
*
*Uses:
*
*Exceptions:
* If pblock does not point to a valid allocation block in the heap,
* realloc() will behave unpredictably and probably corrupt the heap.
*
*******************************************************************************/
void * __cdecl _realloc_base (void * pBlock, size_t newsize)
{
PHEADER pHeader;
void * pvReturn;
size_t oldsize;
size_t origSize = newsize;
// if ptr is NULL, call malloc
if (pBlock == NULL)
return(_malloc_base(newsize));
// if ptr is nonNULL and size is zero, call free and return NULL
if (newsize == 0)
{
_free_base(pBlock);
return(NULL);
}
if ( __active_heap == __V6_HEAP )
{
for (;;)
{
pvReturn = NULL;
if (newsize <= _HEAP_MAXREQ)
{
#ifdef _MT
_mlock( _HEAP_LOCK );
__try
{
#endif /* _MT */
// test if current block is in the small-block heap
if ((pHeader = __sbh_find_block(pBlock)) != NULL)
{
// if the new size is not over __sbh_threshold, attempt
// to reallocate within the small-block heap
if (newsize <= __sbh_threshold)
{
if (__sbh_resize_block(pHeader, pBlock, newsize))
pvReturn = pBlock;
else if ((pvReturn = __sbh_alloc_block(newsize)) != NULL)
{
oldsize = ((PENTRY)((char *)pBlock -
sizeof(int)))->sizeFront - 1;
memcpy(pvReturn, pBlock, __min(oldsize, newsize));
// headers may have moved, get pHeader again
pHeader = __sbh_find_block(pBlock);
__sbh_free_block(pHeader, pBlock);
}
}
// If the reallocation has not been (successfully)
// performed in the small-block heap, try to allocate
// a new block with HeapAlloc.
if (pvReturn == NULL)
{
if (newsize == 0)
newsize = 1;
newsize = (newsize + BYTES_PER_PARA - 1) &
~(BYTES_PER_PARA - 1);
if ((pvReturn = HeapAlloc(_crtheap, 0, newsize)) != NULL)
{
oldsize = ((PENTRY)((char *)pBlock -
sizeof(int)))->sizeFront - 1;
memcpy(pvReturn, pBlock, __min(oldsize, newsize));
__sbh_free_block(pHeader, pBlock);
}
}
}
#ifdef _MT
}
__finally
{
_munlock( _HEAP_LOCK );
}
#endif /* _MT */
// the current block is NOT in the small block heap iff pHeader
// is NULL
if ( pHeader == NULL )
{
if (newsize == 0)
newsize = 1;
newsize = (newsize + BYTES_PER_PARA - 1) &
~(BYTES_PER_PARA - 1);
pvReturn = HeapReAlloc(_crtheap, 0, pBlock, newsize);
}
}
if ( pvReturn || _newmode == 0)
{
return pvReturn;
}
// call installed new handler
if (!_callnewh(newsize))
return NULL;
// new handler was successful -- try to allocate again
}
}
else if ( __active_heap == __V5_HEAP )
{
__old_sbh_region_t *preg;
__old_sbh_page_t * ppage;
__old_page_map_t * pmap;
size_t oldsize;
// round up to the nearest paragrap
if ( newsize <= _HEAP_MAXREQ )
if ( newsize > 0 )
newsize = (newsize + _OLD_PARASIZE - 1) & ~(_OLD_PARASIZE - 1);
else
newsize = _OLD_PARASIZE;
for (;;)
{
pvReturn = NULL;
if ( newsize <= _HEAP_MAXREQ )
{
#ifdef _MT
_mlock( _HEAP_LOCK );
__try
{
#endif /* _MT */
if ( (pmap = __old_sbh_find_block(pBlock, &preg, &ppage)) != NULL )
{
// If the new size falls below __sbh_threshold, try to
// carry out the reallocation within the small-block
// heap.
if ( newsize < __old_sbh_threshold )
{
if ( __old_sbh_resize_block(preg, ppage, pmap,
newsize >> _OLD_PARASHIFT) )
{
pvReturn = pBlock;
}
else if ( (pvReturn = __old_sbh_alloc_block(newsize >>
_OLD_PARASHIFT)) != NULL )
{
oldsize = ((size_t)(*pmap)) << _OLD_PARASHIFT ;
memcpy(pvReturn, pBlock, __min(oldsize, newsize));
__old_sbh_free_block(preg, ppage, pmap);
}
}
// If the reallocation has not been (successfully)
// performed in the small-block heap, try to allocate a
// new block with HeapAlloc.
if ( (pvReturn == NULL) &&
((pvReturn = HeapAlloc(_crtheap, 0, newsize)) != NULL) )
{
oldsize = ((size_t)(*pmap)) << _OLD_PARASHIFT;
memcpy(pvReturn, pBlock, __min(oldsize, newsize));
__old_sbh_free_block(preg, ppage, pmap);
}
}
else
{
pvReturn = HeapReAlloc(_crtheap, 0, pBlock, newsize);
}
#ifdef _MT
}
__finally
{
_munlock(_HEAP_LOCK);
}
#endif /* _MT */
}
if ( pvReturn || _newmode == 0)
{
return pvReturn;
}
// call installed new handler
if (!_callnewh(newsize))
return NULL;
// new handler was successful -- try to allocate again
}
}
else // __active_heap == __SYSTEM_HEAP )
{
for (;;) {
pvReturn = NULL;
if (newsize <= _HEAP_MAXREQ)
{
if (newsize == 0)
newsize = 1;
newsize = (newsize + BYTES_PER_PARA - 1) &
~(BYTES_PER_PARA - 1);
pvReturn = HeapReAlloc(_crtheap, 0, pBlock, newsize);
}
if ( pvReturn || _newmode == 0)
{
return pvReturn;
}
// call installed new handler
if (!_callnewh(newsize))
return NULL;
// new handler was successful -- try to allocate again
}
}
}
#else /* WINHEAP */
#include <cruntime.h>
#include <heap.h>
#include <malloc.h>
#include <mtdll.h>
#include <stddef.h>
#include <string.h>
#include <dbgint.h>
#if defined (_M_MPPC) || defined (_M_M68K)
#include <macos\memory.h> // Mac OS interface header
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/* useful macro to compute the size of an allocation block given both a
* pointer to the descriptor and a pointer to the user area of the block
* (more efficient variant of _BLKSIZE macro, given the extra information)
*/
#define BLKSZ(pdesc_m,pblock_m) ((unsigned)_ADDRESS((pdesc_m)->pnextdesc) - \
(unsigned)(pblock_m))
/* expand an allocation block, in place, up to or beyond a specified size
* by coalescing it with subsequent free blocks (if possible)
*/
static int __cdecl _heap_expand_block(_PBLKDESC, size_t *, size_t);
#if defined (_M_MPPC) || defined (_M_M68K)
extern Handle hHeapRegions;
extern int _heap_region_table_cur;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/***
*void *realloc(void *pblock, size_t newsize) - reallocate a block of memory in
* the heap
*
*Purpose:
* Re-allocates a block in the heap to newsize bytes. newsize may be
* either greater or less than the original size of the block. The
* re-allocation may result in moving the block as well as changing
* the size. If the block is moved, the contents of the original block
* are copied over.
*
* Special ANSI Requirements:
*
* (1) realloc(NULL, newsize) is equivalent to malloc(newsize)
*
* (2) realloc(pblock, 0) is equivalent to free(pblock) (except that
* NULL is returned)
*
* (3) if the realloc() fails, the object pointed to by pblock is left
* unchanged
*
* Special Notes For Multi-thread: The heap is locked immediately prior
* to assigning pdesc. This is after special cases (1) and (2), listed
* above, are taken care of. The lock is released immediately prior to
* the final return statement.
*
*Entry:
* void *pblock - pointer to block in the heap previously allocated
* by a call to malloc(), realloc() or _expand().
*
* size_t newsize - requested size for the re-allocated block
*
*Exit:
* Success: Pointer to the re-allocated memory block
* Failure: NULL
*
*Uses:
*
*Exceptions:
* If pblock does not point to a valid allocation block in the heap,
* realloc() will behave unpredictably and probably corrupt the heap.
*
*******************************************************************************/
void * __cdecl _realloc_base (
REG1 void *pblock,
size_t newsize
)
{
REG2 _PBLKDESC pdesc;
_PBLKDESC pdesc2;
void *retp;
size_t oldsize;
size_t currsize;
/* special cases, handling mandated by ANSI
*/
if ( pblock == NULL )
/* just do a malloc of newsize bytes and return a pointer to
* the new block
*/
return( _malloc_base(newsize) );
if ( newsize == 0 ) {
/* free the block and return NULL
*/
_free_base(pblock);
return( NULL );
}
/* make newsize a valid allocation block size (i.e., round up to the
* nearest whole number of dwords)
*/
newsize = _ROUND2(newsize, _GRANULARITY);
/* if multi-thread support enabled, lock the heap here
*/
_mlock(_HEAP_LOCK);
/* set pdesc to point to the descriptor for *pblock
*/
pdesc = _BACKPTR(pblock);
if ( _ADDRESS(pdesc) != ((char *)pblock - _HDRSIZE) )
_heap_abort();
/* see if pblock is big enough already, or can be expanded (in place)
* to be big enough.
*/
if ( ((oldsize = currsize = BLKSZ(pdesc, pblock)) > newsize) ||
(_heap_expand_block(pdesc, &currsize, newsize) == 0) ) {
/* if necessary, mark pdesc as inuse
*/
if ( _IS_FREE(pdesc) ) {
_SET_INUSE(pdesc);
}
/* trim pdesc down to be exactly newsize bytes, if necessary
*/
if ( (currsize > newsize) &&
((pdesc2 = _heap_split_block(pdesc, newsize)) != NULL) )
{
_SET_FREE(pdesc2);
}
retp = pblock;
goto realloc_done;
}
/* try malloc-ing a new block of the requested size. if successful,
* copy over the data from the original block and free it.
*/
if ( (retp = _malloc_base(newsize)) != NULL ) {
memcpy(retp, pblock, oldsize);
_free_base_lk(pblock);
}
/* else if unsuccessful, return retp (== NULL) */
realloc_done:
/* if multi-thread support is enabled, unlock the heap here
*/
_munlock(_HEAP_LOCK);
return(retp);
}
/***
*void *_expand(void *pblock, size_t newsize) - expand/contract a block of memory
* in the heap
*
*Purpose:
* Resizes a block in the heap to newsize bytes. newsize may be either
* greater (expansion) or less (contraction) than the original size of
* the block. The block is NOT moved. In the case of expansion, if the
* block cannot be expanded to newsize bytes, it is expanded as much as
* possible.
*
* Special Notes For Multi-thread: The heap is locked just before pdesc
* is assigned and unlocked immediately prior to the return statement.
*
*Entry:
* void *pblock - pointer to block in the heap previously allocated
* by a call to malloc(), realloc() or _expand().
*
* size_t newsize - requested size for the resized block
*
*Exit:
* Success: Pointer to the resized memory block (i.e., pblock)
* Failure: NULL
*
*Uses:
*
*Exceptions:
* If pblock does not point to a valid allocation block in the heap,
* _expand() will behave unpredictably and probably corrupt the heap.
*
*******************************************************************************/
void * __cdecl _expand_base (
REG1 void *pblock,
size_t newsize
)
{
REG2 _PBLKDESC pdesc;
_PBLKDESC pdesc2;
void *retp;
size_t oldsize;
size_t currsize;
int index;
#if defined (_M_MPPC) || defined (_M_M68K)
struct _heap_region_ *pHeapRegions;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/* make newsize a valid allocation block size (i.e., round up to the
* nearest whole number of dwords)
*/
newsize = _ROUND2(newsize, _GRANULARITY);
retp = pblock;
/* validate size */
if ( newsize > _HEAP_MAXREQ )
newsize = _HEAP_MAXREQ;
/* if multi-thread support enabled, lock the heap here
*/
_mlock(_HEAP_LOCK);
/* set pdesc to point to the descriptor for *pblock
*/
pdesc = _BACKPTR(pblock);
/* see if pblock is big enough already, or can be expanded (in place)
* to be big enough.
*/
if ( ((oldsize = currsize = BLKSZ(pdesc, pblock)) >= newsize) ||
(_heap_expand_block(pdesc, &currsize, newsize) == 0) ) {
/* pblock is (now) big enough. trim it down, if necessary
*/
if ( (currsize > newsize) &&
((pdesc2 = _heap_split_block(pdesc, newsize)) != NULL) )
{
_SET_FREE(pdesc2);
currsize = newsize;
}
goto expand_done;
}
/* if the heap block is at the end of a region, attempt to grow the
* region
*/
if ( (pdesc->pnextdesc == &_heap_desc.sentinel) ||
_IS_DUMMY(pdesc->pnextdesc) ) {
/* look up the region index
*/
#if defined (_M_MPPC) || defined (_M_M68K)
pHeapRegions = (struct _heap_region_ *)(*hHeapRegions);
for ( index = 0 ; index < _heap_region_table_cur ; index++ )
if (((pHeapRegions + index)->_regbase < pblock) &&
(((char *)((pHeapRegions + index)->_regbase) +
(pHeapRegions + index)->_currsize) >= (char *)pblock) )
break;
#else /* defined (_M_MPPC) || defined (_M_M68K) */
for ( index = 0 ; index < _HEAP_REGIONMAX ; index++ )
if ( (_heap_regions[index]._regbase < pblock) &&
(((char *)(_heap_regions[index]._regbase) +
_heap_regions[index]._currsize) >=
(char *)pblock) )
break;
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
/* make sure a valid region index was obtained (pblock could
* lie in a portion of heap memory donated by a user call to
* _heapadd(), which therefore would not appear in the region
* table)
*/
#if defined (_M_MPPC) || defined (_M_M68K)
if ( index == _heap_region_table_cur ) {
#else /* defined (_M_MPPC) || defined (_M_M68K) */
if ( index == _HEAP_REGIONMAX ) {
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
retp = NULL;
goto expand_done;
}
/* try growing the region. the difference between newsize and
* the current size of the block, rounded up to the nearest
* whole number of pages, is the amount the region needs to
* be grown. if successful, try expanding the block again
*/
if ( (_heap_grow_region(index, _ROUND2(newsize - currsize,
_PAGESIZE_)) == 0) &&
(_heap_expand_block(pdesc, &currsize, newsize) == 0) )
{
/* pblock is (now) big enough. trim it down to be
* exactly size bytes, if necessary
*/
if ( (currsize > newsize) && ((pdesc2 =
_heap_split_block(pdesc, newsize)) != NULL) )
{
_SET_FREE(pdesc2);
currsize = newsize;
}
}
else
retp = NULL;
}
else
retp = NULL;
expand_done:
/* if multi-thread support is enabled, unlock the heap here
*/
_munlock(_HEAP_LOCK);
return(retp);
}
/***
*int _heap_expand_block(pdesc, pcurrsize, newsize) - expand an allocation block
* in place (without trying to 'grow' the heap)
*
*Purpose:
*
*Entry:
* _PBLKDESC pdesc - pointer to the allocation block descriptor
* size_t *pcurrsize - pointer to size of the allocation block (i.e.,
* *pcurrsize == _BLKSIZE(pdesc), on entry)
* size_t newsize - requested minimum size for the expanded allocation
* block (i.e., newsize >= _BLKSIZE(pdesc), on exit)
*
*Exit:
* Success: 0
* Failure: -1
* In either case, *pcurrsize is updated with the new size of the block
*
*Exceptions:
* It is assumed that pdesc points to a valid allocation block descriptor.
* It is also assumed that _BLKSIZE(pdesc) == *pcurrsize on entry. If
* either of these assumptions is violated, _heap_expand_block will almost
* certainly trash the heap.
*
*******************************************************************************/
static int __cdecl _heap_expand_block (
REG1 _PBLKDESC pdesc,
REG3 size_t *pcurrsize,
size_t newsize
)
{
REG2 _PBLKDESC pdesc2;
_ASSERTE(("_heap_expand_block: bad pdesc arg", _CHECK_PDESC(pdesc)));
_ASSERTE(("_heap_expand_block: bad pcurrsize arg", *pcurrsize == _BLKSIZE(pdesc)));
for ( pdesc2 = pdesc->pnextdesc ; _IS_FREE(pdesc2) ;
pdesc2 = pdesc->pnextdesc ) {
/* coalesce with pdesc. check for special case of pdesc2
* being proverdesc.
*/
pdesc->pnextdesc = pdesc2->pnextdesc;
if ( pdesc2 == _heap_desc.proverdesc )
_heap_desc.proverdesc = pdesc;
/* update *pcurrsize, place *pdesc2 on the empty descriptor
* list and see if the coalesced block is now big enough
*/
*pcurrsize += _MEMSIZE(pdesc2);
_PUTEMPTY(pdesc2)
}
if ( *pcurrsize >= newsize )
return(0);
else
return(-1);
}
#endif /* WINHEAP */
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,878 @@
/***
*strftime.c - String Format Time
*
* Copyright (c) 1988-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
*
*******************************************************************************/
#ifdef _MAC
#define _WLM_NOFORCE_LIBS
#include <windows.h>
#ifdef _WIN32
#undef _WIN32 /* windows.h should NOT set _WIN32 */
#endif /* _WIN32 */
/* The following two TYPEDEFs are NOT defined in <windows.h> for the Mac */
typedef DWORD LCTYPE; /* from windows.h */
typedef int mbstate_t; /* from wchar.h */
#endif /* _MAC */
#include <cruntime.h>
#include <internal.h>
#include <mtdll.h>
#include <time.h>
#include <locale.h>
#include <setlocal.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <xlocinfo.h>
/* Prototypes for local routines */
static void __cdecl _expandtime (char specifier, const struct tm *tmptr,
char **out, size_t *count, struct __lc_time_data *lc_time);
static void __cdecl _store_str (char *in, char **out, size_t *count);
static void __cdecl _store_num (int num, int digits, char **out, size_t *count);
static void __cdecl _store_number (int num, char **out, size_t *count);
static void __cdecl _store_winword (const char *format, const struct tm *tmptr, char **out, size_t *count, struct __lc_time_data *lc_time);
/* LC_TIME data for local "C" */
__declspec(selectany) struct __lc_time_data __lc_time_c = {
{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"},
{"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", },
{"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"},
{"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October",
"November", "December"},
{"AM", "PM"}
, { "M/d/yy" }
, { "dddd, MMMM dd, yyyy" }
, { "H:mm:ss" }
};
/* Pointer to the current LC_TIME data structure. */
struct __lc_time_data *__lc_time_curr = &__lc_time_c;
/* Flags */
unsigned __alternate_form;
unsigned __no_lead_zeros;
#define TIME_SEP ':'
/* get a copy of the current day names */
char * __cdecl _Getdays (
void
)
{
const struct __lc_time_data *pt = __lc_time_curr;
size_t n, len = 0;
char *p;
for (n = 0; n < 7; ++n)
len += strlen(pt->wday_abbr[n]) + strlen(pt->wday[n]) + 2;
p = (char *)malloc(len + 1);
if (p != 0) {
char *s = p;
for (n = 0; n < 7; ++n) {
*s++ = TIME_SEP;
s += strlen(strcpy(s, pt->wday_abbr[n]));
*s++ = TIME_SEP;
s += strlen(strcpy(s, pt->wday[n]));
}
*s++ = '\0';
}
return (p);
}
/* get a copy of the current month names */
char * __cdecl _Getmonths (
void
)
{
const struct __lc_time_data *pt = __lc_time_curr;
size_t n, len = 0;
char *p;
for (n = 0; n < 12; ++n)
len += strlen(pt->month_abbr[n]) + strlen(pt->month[n]) + 2;
p = (char *)malloc(len + 1);
if (p != 0) {
char *s = p;
for (n = 0; n < 12; ++n) {
*s++ = TIME_SEP;
s += strlen(strcpy(s, pt->month_abbr[n]));
*s++ = TIME_SEP;
s += strlen(strcpy(s, pt->month[n]));
}
*s++ = '\0';
}
return (p);
}
/* get a copy of the current time locale information */
void * __cdecl _Gettnames (
void
)
{
const struct __lc_time_data *pt = __lc_time_curr;
size_t n, len = 0;
void *p;
for (n = 0; n < 7; ++n)
len += strlen(pt->wday_abbr[n]) + strlen(pt->wday[n]) + 2;
for (n = 0; n < 12; ++n)
len += strlen(pt->month_abbr[n]) + strlen(pt->month[n]) + 2;
len += strlen(pt->ampm[0]) + strlen(pt->ampm[1]) + 2;
len += strlen(pt->ww_sdatefmt) + 1;
len += strlen(pt->ww_ldatefmt) + 1;
len += strlen(pt->ww_timefmt) + 1;
p = malloc(sizeof (*pt) + len);
if (p != 0)
{struct __lc_time_data *pn = (struct __lc_time_data *)p;
char *s = (char *)p + sizeof (*pt);
memcpy(p, __lc_time_curr, sizeof (*pt));
for (n = 0; n < 7; ++n)
{pn->wday_abbr[n] = s;
s += strlen(strcpy(s, pt->wday_abbr[n])) + 1;
pn->wday[n] = s;
s += strlen(strcpy(s, pt->wday[n])) + 1; }
for (n = 0; n < 12; ++n)
{pn->month_abbr[n] = s;
s += strlen(strcpy(s, pt->month_abbr[n])) + 1;
pn->month[n] = s;
s += strlen(strcpy(s, pt->month[n])) + 1; }
pn->ampm[0] = s;
s += strlen(strcpy(s, pt->ampm[0])) + 1;
pn->ampm[1] = s;
s += strlen(strcpy(s, pt->ampm[1])) + 1;
pn->ww_sdatefmt = s;
s += strlen(strcpy(s, pt->ww_sdatefmt)) + 1;
pn->ww_ldatefmt = s;
s += strlen(strcpy(s, pt->ww_ldatefmt)) + 1;
pn->ww_timefmt = s; }
return (p);
}
/***
*size_t strftime(string, maxsize, format, timeptr) - Format a time string
*
*Purpose:
* Place characters into the user's output buffer expanding time
* format directives as described in the user's control string.
* Use the supplied 'tm' structure for time data when expanding
* the format directives.
* [ANSI]
*
*Entry:
* char *string = pointer to output string
* size_t maxsize = max length of string
* const char *format = format control string
* const struct tm *timeptr = pointer to tb data structure
*
*Exit:
* !0 = If the total number of resulting characters including the
* terminating null is not more than 'maxsize', then return the
* number of chars placed in the 'string' array (not including the
* null terminator).
*
* 0 = Otherwise, return 0 and the contents of the string are
* indeterminate.
*
*Exceptions:
*
*******************************************************************************/
size_t __cdecl strftime (
char *string,
size_t maxsize,
const char *format,
const struct tm *timeptr
)
{
return (_Strftime(string, maxsize, format, timeptr, 0));
}
/***
*size_t _Strftime(string, maxsize, format,
* timeptr, lc_time) - Format a time string for a given locale
*
*Purpose:
* Place characters into the user's output buffer expanding time
* format directives as described in the user's control string.
* Use the supplied 'tm' structure for time data when expanding
* the format directives. use the locale information at lc_time.
* [ANSI]
*
*Entry:
* char *string = pointer to output string
* size_t maxsize = max length of string
* const char *format = format control string
* const struct tm *timeptr = pointer to tb data structure
* struct __lc_time_data *lc_time = pointer to locale-specific info
* (passed as void * to avoid type mismatch with C++)
*
*Exit:
* !0 = If the total number of resulting characters including the
* terminating null is not more than 'maxsize', then return the
* number of chars placed in the 'string' array (not including the
* null terminator).
*
* 0 = Otherwise, return 0 and the contents of the string are
* indeterminate.
*
*Exceptions:
*
*******************************************************************************/
size_t __cdecl _Strftime (
char *string,
size_t maxsize,
const char *format,
const struct tm *timeptr,
void *lc_time_arg
)
{
struct __lc_time_data *lc_time;
size_t left; /* space left in output string */
#ifdef _MT
int local_lock_flag;
#endif /* _MT */
/* Copy maxsize into temp. */
left = maxsize;
_lock_locale( local_lock_flag )
/* Defer initialization until the crtitical section has been entered */
lc_time = lc_time_arg == 0 ? __lc_time_curr : (struct __lc_time_data *)lc_time_arg;
/* Copy the input string to the output string expanding the format
designations appropriately. Stop copying when one of the following
is true: (1) we hit a null char in the input stream, or (2) there's
no room left in the output stream. */
while (left > 0)
{
switch(*format)
{
case('\0'):
/* end of format input string */
goto done;
case('%'):
/* Format directive. Take appropriate action based
on format control character. */
format++; /* skip over % char */
/* process flags */
__alternate_form = 0;
if (*format == '#')
{
__alternate_form = 1;
format++;
}
_expandtime(*format, timeptr, &string, &left,
lc_time);
format++; /* skip format char */
break;
default:
/* store character, bump pointers, dec the char count */
if (isleadbyte((int)(*format)) && left > 1)
{
*string++ = *format++;
left--;
}
*string++ = *format++;
left--;
break;
}
}
/* All done. See if we terminated because we hit a null char or because
we ran out of space */
done:
_unlock_locale( local_lock_flag )
if (left > 0) {
/* Store a terminating null char and return the number of chars
we stored in the output string. */
*string = '\0';
return(maxsize-left);
}
else
return(0);
}
/***
*_expandtime() - Expand the conversion specifier
*
*Purpose:
* Expand the given strftime conversion specifier using the time struct
* and store it in the supplied buffer.
*
* The expansion is locale-dependent.
*
* *** For internal use with strftime() only ***
*
*Entry:
* char specifier = strftime conversion specifier to expand
* const struct tm *tmptr = pointer to time/date structure
* char **string = address of pointer to output string
* size_t *count = address of char count (space in output area)
* struct __lc_time_data *lc_time = pointer to locale-specific info
*
*Exit:
* none
*
*Exceptions:
*
*******************************************************************************/
static void __cdecl _expandtime (
char specifier,
const struct tm *timeptr,
char **string,
size_t *left,
struct __lc_time_data *lc_time
)
{
unsigned temp; /* temps */
int wdaytemp;
/* Use a copy of the appropriate __lc_time_data pointer. This
should prevent the necessity of locking/unlocking in mthread
code (if we can guarantee that the various __lc_time data
structures are always in the same segment). contents of time
strings structure can now change, so thus we do use locking */
switch(specifier) { /* switch on specifier */
case('a'): /* abbreviated weekday name */
_store_str((char *)(lc_time->wday_abbr[timeptr->tm_wday]),
string, left);
break;
case('A'): /* full weekday name */
_store_str((char *)(lc_time->wday[timeptr->tm_wday]),
string, left);
break;
case('b'): /* abbreviated month name */
_store_str((char *)(lc_time->month_abbr[timeptr->tm_mon]),
string, left);
break;
case('B'): /* full month name */
_store_str((char *)(lc_time->month[timeptr->tm_mon]),
string, left);
break;
case('c'): /* date and time display */
if (__alternate_form)
{
__alternate_form = FALSE;
_store_winword(lc_time->ww_ldatefmt, timeptr, string, left, lc_time);
if (*left == 0)
return;
*(*string)++=' ';
(*left)--;
_store_winword(lc_time->ww_timefmt, timeptr, string, left, lc_time);
}
else {
_store_winword(lc_time->ww_sdatefmt, timeptr, string, left, lc_time);
if (*left == 0)
return;
*(*string)++=' ';
(*left)--;
_store_winword(lc_time->ww_timefmt, timeptr, string, left, lc_time);
}
break;
case('d'): /* mday in decimal (01-31) */
__no_lead_zeros = __alternate_form;
_store_num(timeptr->tm_mday, 2, string, left);
break;
case('H'): /* 24-hour decimal (00-23) */
__no_lead_zeros = __alternate_form;
_store_num(timeptr->tm_hour, 2, string, left);
break;
case('I'): /* 12-hour decimal (01-12) */
__no_lead_zeros = __alternate_form;
if (!(temp = timeptr->tm_hour%12))
temp=12;
_store_num(temp, 2, string, left);
break;
case('j'): /* yday in decimal (001-366) */
__no_lead_zeros = __alternate_form;
_store_num(timeptr->tm_yday+1, 3, string, left);
break;
case('m'): /* month in decimal (01-12) */
__no_lead_zeros = __alternate_form;
_store_num(timeptr->tm_mon+1, 2, string, left);
break;
case('M'): /* minute in decimal (00-59) */
__no_lead_zeros = __alternate_form;
_store_num(timeptr->tm_min, 2, string, left);
break;
case('p'): /* AM/PM designation */
if (timeptr->tm_hour <= 11)
_store_str((char *)(lc_time->ampm[0]), string, left);
else
_store_str((char *)(lc_time->ampm[1]), string, left);
break;
case('S'): /* secs in decimal (00-59) */
__no_lead_zeros = __alternate_form;
_store_num(timeptr->tm_sec, 2, string, left);
break;
case('U'): /* sunday week number (00-53) */
__no_lead_zeros = __alternate_form;
wdaytemp = timeptr->tm_wday;
goto weeknum; /* join common code */
case('w'): /* week day in decimal (0-6) */
__no_lead_zeros = __alternate_form;
_store_num(timeptr->tm_wday, 1, string, left);
break;
case('W'): /* monday week number (00-53) */
__no_lead_zeros = __alternate_form;
if (timeptr->tm_wday == 0) /* monday based */
wdaytemp = 6;
else
wdaytemp = timeptr->tm_wday-1;
weeknum:
if (timeptr->tm_yday < wdaytemp)
temp=0;
else {
temp = timeptr->tm_yday/7;
if ((timeptr->tm_yday%7) >= wdaytemp)
temp++;
}
_store_num(temp, 2, string, left);
break;
case('x'): /* date display */
if (__alternate_form)
{
__alternate_form = FALSE;
_store_winword(lc_time->ww_ldatefmt, timeptr, string, left, lc_time);
}
else
{
_store_winword(lc_time->ww_sdatefmt, timeptr, string, left, lc_time);
}
break;
case('X'): /* time display */
__alternate_form = FALSE;
_store_winword(lc_time->ww_timefmt, timeptr, string, left, lc_time);
break;
case('y'): /* year w/o century (00-99) */
__no_lead_zeros = __alternate_form;
temp = timeptr->tm_year%100;
_store_num(temp, 2, string, left);
break;
case('Y'): /* year w/ century */
__no_lead_zeros = __alternate_form;
temp = (((timeptr->tm_year/100)+19)*100) +
(timeptr->tm_year%100);
_store_num(temp, 4, string, left);
break;
case('Z'): /* time zone name, if any */
case('z'): /* time zone name, if any */
#ifdef _MAC
_tzset(); /* Set time zone info */
#else /* _MAC */
__tzset(); /* Set time zone info */
#endif /* _MAC */
_store_str(_tzname[((timeptr->tm_isdst)?1:0)],
string, left);
break;
case('%'): /* percent sign */
*(*string)++ = '%';
(*left)--;
break;
default: /* unknown format directive */
/* ignore the directive and continue */
/* [ANSI: Behavior is undefined.] */
break;
} /* end % switch */
}
/***
*_store_str() - Copy a time string
*
*Purpose:
* Copy the supplied time string into the output string until
* (1) we hit a null in the time string, or (2) the given count
* goes to 0.
*
* *** For internal use with strftime() only ***
*
*Entry:
* char *in = pointer to null terminated time string
* char **out = address of pointer to output string
* size_t *count = address of char count (space in output area)
*
*Exit:
* none
*Exceptions:
*
*******************************************************************************/
static void __cdecl _store_str (
char *in,
char **out,
size_t *count
)
{
while ((*count != 0) && (*in != '\0')) {
*(*out)++ = *in++;
(*count)--;
}
}
/***
*_store_num() - Convert a number to ascii and copy it
*
*Purpose:
* Convert the supplied number to decimal and store
* in the output buffer. Update both the count and
* buffer pointers.
*
* *** For internal use with strftime() only ***
*
*Entry:
* int num = pointer to integer value
* int digits = # of ascii digits to put into string
* char **out = address of pointer to output string
* size_t *count = address of char count (space in output area)
*
*Exit:
* none
*Exceptions:
*
*******************************************************************************/
static void __cdecl _store_num (
int num,
int digits,
char **out,
size_t *count
)
{
int temp=0;
if (__no_lead_zeros) {
_store_number (num, out, count);
return;
}
if ((size_t)digits < *count) {
for (digits--; (digits+1); digits--) {
(*out)[digits] = (char)('0' + num % 10);
num /= 10;
temp++;
}
*out += temp;
*count -= temp;
}
else
*count = 0;
}
/***
*_store_number() - Convert positive integer to string
*
*Purpose:
* Convert positive integer to a string and store it in the output
* buffer with no null terminator. Update both the count and
* buffer pointers.
*
* Differs from _store_num in that the precision is not specified,
* and no leading zeros are added.
*
* *** For internal use with strftime() only ***
*
* Created from xtoi.c
*
*Entry:
* int num = pointer to integer value
* char **out = address of pointer to output string
* size_t *count = address of char count (space in output area)
*
*Exit:
* none
*
*Exceptions:
* The buffer is filled until it is out of space. There is no
* way to tell beforehand (as in _store_num) if the buffer will
* run out of space.
*
*******************************************************************************/
static void __cdecl _store_number (
int num,
char **out,
size_t *count
)
{
char *p; /* pointer to traverse string */
char *firstdig; /* pointer to first digit */
char temp; /* temp char */
p = *out;
/* put the digits in the buffer in reverse order */
if (*count > 1)
{
do {
*p++ = (char) (num % 10 + '0');
(*count)--;
} while ((num/=10) > 0 && *count > 1);
}
firstdig = *out; /* firstdig points to first digit */
*out = p; /* return pointer to next space */
p--; /* p points to last digit */
/* reverse the buffer */
do {
temp = *p;
*p-- = *firstdig;
*firstdig++ = temp; /* swap *p and *firstdig */
} while (firstdig < p); /* repeat until halfway */
}
/***
*_store_winword() - Store date/time in WinWord format
*
*Purpose:
* Format the date/time in the supplied WinWord format
* and store it in the supplied buffer.
*
* *** For internal use with strftime() only ***
*
* The WinWord format is converted token by token to
* strftime conversion specifiers. _expandtime is then called to
* do the work. The WinWord format is expected to be a
* character string (not wide-chars).
*
*Entry:
* const char **format = address of pointer to WinWord format
* const struct tm *tmptr = pointer to time/date structure
* char **out = address of pointer to output string
* size_t *count = address of char count (space in output area)
* struct __lc_time_data *lc_time = pointer to locale-specific info
*
*Exit:
* none
*
*Exceptions:
*
*******************************************************************************/
static void __cdecl _store_winword (
const char *format,
const struct tm *tmptr,
char **out,
size_t *count,
struct __lc_time_data *lc_time
)
{
char specifier;
const char *p;
int repeat;
char *ampmstr;
while (*format && *count != 0)
{
specifier = 0; /* indicate no match */
__no_lead_zeros = 0; /* default is print leading zeros */
/* count the number of repetitions of this character */
for (repeat=0, p=format; *p++ == *format; repeat++);
/* leave p pointing to the beginning of the next token */
p--;
/* switch on ascii format character and determine specifier */
switch (*format)
{
case 'M':
switch (repeat)
{
case 1: __no_lead_zeros = 1; /* fall thru */
case 2: specifier = 'm'; break;
case 3: specifier = 'b'; break;
case 4: specifier = 'B'; break;
} break;
case 'd':
switch (repeat)
{
case 1: __no_lead_zeros = 1; /* fall thru */
case 2: specifier = 'd'; break;
case 3: specifier = 'a'; break;
case 4: specifier = 'A'; break;
} break;
case 'y':
switch (repeat)
{
case 2: specifier = 'y'; break;
case 4: specifier = 'Y'; break;
} break;
case 'h':
switch (repeat)
{
case 1: __no_lead_zeros = 1; /* fall thru */
case 2: specifier = 'I'; break;
} break;
case 'H':
switch (repeat)
{
case 1: __no_lead_zeros = 1; /* fall thru */
case 2: specifier = 'H'; break;
} break;
case 'm':
switch (repeat)
{
case 1: __no_lead_zeros = 1; /* fall thru */
case 2: specifier = 'M'; break;
} break;
case 's': /* for compatibility; not strictly WinWord */
switch (repeat)
{
case 1: __no_lead_zeros = 1; /* fall thru */
case 2: specifier = 'S'; break;
} break;
case 'A':
case 'a':
if (!_stricmp(format, "am/pm"))
p = format + 5;
else if (!_stricmp(format, "a/p"))
p = format + 3;
specifier = 'p';
break;
case 't': /* t or tt time marker suffix */
if ( tmptr->tm_hour <= 11 )
ampmstr = lc_time->ampm[0];
else
ampmstr = lc_time->ampm[1];
while ( (repeat > 0) && (*count > 0) )
{
if ( isleadbyte((int)*ampmstr) &&
(*count > 1) )
{
*(*out)++ = *ampmstr++;
(*count)--;
}
*(*out)++ = *ampmstr++;
(*count)--;
repeat--;
}
format = p;
continue;
case '\'': /* literal string */
if (repeat & 1) /* odd number */
{
format += repeat;
while (*format && *count != 0)
{
if (*format == '\'')
{
format++;
break;
}
if ( isleadbyte((int)*format) &&
(*count > 1) )
{
*(*out)++ = *format++;
(*count)--;
}
*(*out)++ = *format++;
(*count)--;
}
}
else { /* even number */
format += repeat;
}
continue;
default: /* non-control char, print it */
break;
} /* switch */
/* expand specifier, or copy literal if specifier not found */
if (specifier)
{
_expandtime(specifier, tmptr, out, count, lc_time);
format = p; /* bump format up to the next token */
} else {
if (isleadbyte((int)*format))
{
*(*out)++ = *format++;
(*count)--;
}
*(*out)++ = *format++;
(*count)--;
}
} /* while */
}
@@ -0,0 +1,933 @@
/***
*tzset.c - set timezone information and see if we're in daylight time
*
* Copyright (c) 1985-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* defines _tzset() - set timezone and daylight saving time vars
*
*******************************************************************************/
#ifdef _WIN32
#include <cruntime.h>
#include <ctype.h>
#include <ctime.h>
#include <time.h>
#include <stdlib.h>
#include <internal.h>
#include <mtdll.h>
#include <windows.h>
#include <setlocal.h>
#include <string.h>
#include <dbgint.h>
/*
* Number of milliseconds in one day
*/
#define DAY_MILLISEC (24L * 60L * 60L * 1000L)
/*
* The macro below is valid for years between 1901 and 2099, which easily
* includes all years representable by the current implementation of time_t.
*/
#define IS_LEAP_YEAR(year) ( (year & 3) == 0 )
/*
* Pointer to a saved copy of the TZ value obtained in the previous call
* to tzset() set (if any).
*/
static char * lastTZ = NULL;
/*
* Flag indicating that time zone information came from GetTimeZoneInformation
* API call.
*/
static int tzapiused;
static TIME_ZONE_INFORMATION tzinfo;
/*
* Structure used to represent DST transition date/times.
*/
typedef struct {
int yr; /* year of interest */
int yd; /* day of year */
long ms; /* milli-seconds in the day */
} transitiondate;
/*
* DST start and end structs.
*/
static transitiondate dststart = { -1, 0, 0L };
static transitiondate dstend = { -1, 0, 0L };
static int __cdecl _isindst_lk(struct tm *);
/***
*void tzset() - sets timezone information and calc if in daylight time
*
*Purpose:
* Sets the timezone information from the TZ environment variable
* and then sets _timezone, _daylight, and _tzname. If we're in daylight
* time is automatically calculated.
*
*Entry:
* None, reads TZ environment variable.
*
*Exit:
* sets _daylight, _timezone, and _tzname global vars, no return value
*
*Exceptions:
*
*******************************************************************************/
#ifdef _MT
static void __cdecl _tzset_lk(void);
#else /* _MT */
#define _tzset_lk _tzset
#endif /* _MT */
void __cdecl __tzset(void)
{
static int first_time = 0;
if ( !first_time ) {
_mlock( _TIME_LOCK );
if ( !first_time ) {
_tzset_lk();
first_time++;
}
_munlock(_TIME_LOCK );
}
}
#ifdef _MT
void __cdecl _tzset (
void
)
{
_mlock( _TIME_LOCK );
_tzset_lk();
_munlock( _TIME_LOCK );
}
static void __cdecl _tzset_lk (
#else /* _MT */
void __cdecl _tzset (
#endif /* _MT */
void
)
{
char *TZ;
int defused;
int negdiff = 0;
_mlock(_ENV_LOCK);
/*
* Clear the flag indicated whether GetTimeZoneInformation was used.
*/
tzapiused = 0;
/*
* Set year fields of dststart and dstend structures to -1 to ensure
* they are recomputed as after this
*/
dststart.yr = dstend.yr = -1;
/*
* Fetch the value of the TZ environment variable.
*/
if ( (TZ = _getenv_lk("TZ")) == NULL ) {
/*
* There is no TZ environment variable, try to use the time zone
* information from the system.
*/
_munlock(_ENV_LOCK);
if ( GetTimeZoneInformation( &tzinfo ) != 0xFFFFFFFF ) {
/*
* Note that the API was used.
*/
tzapiused = 1;
/*
* Derive _timezone value from Bias and StandardBias fields.
*/
_timezone = tzinfo.Bias * 60L;
if ( tzinfo.StandardDate.wMonth != 0 )
_timezone += (tzinfo.StandardBias * 60L);
/*
* Check to see if there is a daylight time bias. Since the
* StandardBias has been added into _timezone, it must be
* compensated for in the value computed for _dstbias.
*/
if ( (tzinfo.DaylightDate.wMonth != 0) &&
(tzinfo.DaylightBias != 0) )
{
_daylight = 1;
_dstbias = (tzinfo.DaylightBias - tzinfo.StandardBias) *
60L;
}
else {
_daylight = 0;
/*
* Set daylight bias to 0 because GetTimeZoneInformation
* may return TIME_ZONE_ID_DAYLIGHT even though there is
* no DST (in NT 3.51, just turn off the automatic DST
* adjust in the control panel)!
*/
_dstbias = 0;
}
/*
* Try to grab the name strings for both the time zone and the
* daylight zone. Note the wide character strings in tzinfo
* must be converted to multibyte characters strings. The
* locale codepage, __lc_codepage, is used for this. Note that
* if setlocale() with LC_ALL or LC_CTYPE has not been called,
* then __lc_codepage will be 0 (_CLOCALECP), which is CP_ACP
* (which means use the host's default ANSI codepage).
*/
if ( (WideCharToMultiByte( __lc_codepage,
WC_COMPOSITECHECK |
WC_SEPCHARS,
tzinfo.StandardName,
-1,
_tzname[0],
63,
NULL,
&defused ) != 0) &&
(!defused) )
_tzname[0][63] = '\0';
else
_tzname[0][0] = '\0';
if ( (WideCharToMultiByte( __lc_codepage,
WC_COMPOSITECHECK |
WC_SEPCHARS,
tzinfo.DaylightName,
-1,
_tzname[1],
63,
NULL,
&defused ) != 0) &&
(!defused) )
_tzname[1][63] = '\0';
else
_tzname[1][0] = '\0';
}
/*
* Time zone information is unavailable, just return.
*/
return;
}
if ( (*TZ == '\0') || ((lastTZ != NULL) && (strcmp(TZ, lastTZ) == 0)) )
{
/*
* Either TZ is NULL, pointing to '\0', or is the unchanged
* from a earlier call (to this function). In any case, there
* is no work to do, so just return
*/
_munlock(_ENV_LOCK);
return;
}
/*
* Update lastTZ
*/
_free_crt(lastTZ);
if ((lastTZ = _malloc_crt(strlen(TZ)+1)) == NULL)
{
_munlock(_ENV_LOCK);
return;
}
strcpy(lastTZ, TZ);
_munlock(_ENV_LOCK);
/*
* Process TZ value and update _tzname, _timezone and _daylight.
*/
strncpy(_tzname[0], TZ, 3);
_tzname[0][3] = '\0';
/*
* time difference is of the form:
*
* [+|-]hh[:mm[:ss]]
*
* check minus sign first.
*/
if ( *(TZ += 3) == '-' ) {
negdiff++;
TZ++;
}
/*
* process, then skip over, the hours
*/
_timezone = atol(TZ) * 3600L;
while ( (*TZ == '+') || ((*TZ >= '0') && (*TZ <= '9')) ) TZ++;
/*
* check if minutes were specified
*/
if ( *TZ == ':' ) {
/*
* process, then skip over, the minutes
*/
_timezone += atol(++TZ) * 60L;
while ( (*TZ >= '0') && (*TZ <= '9') ) TZ++;
/*
* check if seconds were specified
*/
if ( *TZ == ':' ) {
/*
* process, then skip over, the seconds
*/
_timezone += atol(++TZ);
while ( (*TZ >= '0') && (*TZ <= '9') ) TZ++;
}
}
if ( negdiff )
_timezone = -_timezone;
/*
* finally, check for a DST zone suffix
*/
if ( _daylight = *TZ ) {
strncpy(_tzname[1], TZ, 3);
_tzname[1][3] = '\0';
}
else
*_tzname[1] = '\0';
}
/***
*static void cvtdate( trantype, datetype, year, month, week, dayofweek,
* date, hour, min, second, millisec ) - convert
* transition date format
*
*Purpose:
* Convert the format of a transition date specification to a value of
* a transitiondate structure.
*
*Entry:
* int trantype - 1, if it is the start of DST
* 0, if is the end of DST (in which case the date is
* is a DST date)
* int datetype - 1, if a day-in-month format is specified.
* 0, if an absolute date is specified.
* int year - year for which the date is being converted (70 ==
* 1970)
* int month - month (0 == January)
* int week - week of month, if datetype == 1 (note that 5== last
* week of month),
* 0, otherwise.
* int dayofweek - day of week (0 == Sunday), if datetype == 1.
* 0, otherwise.
* int date - date of month (1 - 31)
* int hour - hours (0 - 23)
* int min - minutes (0 - 59)
* int sec - seconds (0 - 59)
* int msec - milliseconds (0 - 999)
*
*Exit:
* dststart or dstend is filled in with the converted date.
*
*******************************************************************************/
static void __cdecl cvtdate (
int trantype,
int datetype,
int year,
int month,
int week,
int dayofweek,
int date,
int hour,
int min,
int sec,
int msec
)
{
int yearday;
int monthdow;
if ( datetype == 1 ) {
/*
* Transition day specified in day-in-month format.
*/
/*
* Figure the year-day of the start of the month.
*/
yearday = 1 + (IS_LEAP_YEAR(year) ? _lpdays[month - 1] :
_days[month - 1]);
/*
* Figure the day of the week of the start of the month.
*/
monthdow = (yearday + ((year - 70) * 365) + ((year - 1) >> 2) -
_LEAP_YEAR_ADJUST + _BASE_DOW) % 7;
/*
* Figure the year-day of the transition date
*/
if ( monthdow <= dayofweek )
yearday += (dayofweek - monthdow) + (week - 1) * 7;
else
yearday += (dayofweek - monthdow) + week * 7;
/*
* May have to adjust the calculation above if week == 5 (meaning
* the last instance of the day in the month). Check if year falls
* beyond after month and adjust accordingly.
*/
if ( (week == 5) &&
(yearday > (IS_LEAP_YEAR(year) ? _lpdays[month] :
_days[month])) )
{
yearday -= 7;
}
}
else {
/*
* Transition day specified as an absolute day
*/
yearday = IS_LEAP_YEAR(year) ? _lpdays[month - 1] :
_days[month - 1];
yearday += date;
}
if ( trantype == 1 ) {
/*
* Converted date was for the start of DST
*/
dststart.yd = yearday;
dststart.ms = (long)msec +
(1000L * (sec + 60L * (min + 60L * hour)));
/*
* Set year field of dststart so that unnecessary calls to
* cvtdate() may be avoided.
*/
dststart.yr = year;
}
else {
/*
* Converted date was for the end of DST
*/
dstend.yd = yearday;
dstend.ms = (long)msec +
(1000L * (sec + 60L * (min + 60L * hour)));
/*
* The converted date is still a DST date. Must convert to a
* standard (local) date while being careful the millisecond field
* does not overflow or underflow.
*/
if ( (dstend.ms += (_dstbias * 1000L)) < 0 ) {
dstend.ms += DAY_MILLISEC;
dstend.yd--;
}
else if ( dstend.ms >= DAY_MILLISEC ) {
dstend.ms -= DAY_MILLISEC;
dstend.yd++;
}
/*
* Set year field of dstend so that unnecessary calls to cvtdate()
* may be avoided.
*/
dstend.yr = year;
}
return;
}
/***
*int _isindst(tb) - determine if broken-down time falls in DST
*
*Purpose:
* Determine if the given broken-down time falls within daylight saving
* time (DST). The DST rules are either obtained from Win32 (tzapiused !=
* TRUE) or assumed to be USA rules, post 1986.
*
* If the DST rules are obtained from Win32's GetTimeZoneInformation API,
* the transition dates to/from DST can be specified in either of two
* formats. First, a day-in-month format, similar to the way USA rules
* are specified, can be used. The transition date is given as the n-th
* occurence of a specified day of the week in a specified month. Second,
* an absolute date can be specified. The two cases are distinguished by
* the value of wYear field in the SYSTEMTIME structure (0 denotes a
* day-in-month format).
*
* USA rules for DST are that a time is in DST iff it is on or after
* 02:00 on the first Sunday in April, and before 01:00 on the last
* Sunday in October.
*
*Entry:
* struct tm *tb - structure holding broken-down time value
*
*Exit:
* 1, if time represented is in DST
* 0, otherwise
*
*******************************************************************************/
int __cdecl _isindst (
struct tm *tb
)
#ifdef _MT
{
int retval;
_mlock( _TIME_LOCK );
retval = _isindst_lk( tb );
_munlock( _TIME_LOCK );
return retval;
}
static int __cdecl _isindst_lk (
struct tm *tb
)
#endif /* _MT */
{
long ms;
if ( _daylight == 0 )
return 0;
/*
* Compute (recompute) the transition dates for daylight saving time
* if necessary.The yr (year) fields of dststart and dstend is
* compared to the year of interest to determine necessity.
*/
if ( (tb->tm_year != dststart.yr) || (tb->tm_year != dstend.yr) ) {
if ( tzapiused ) {
/*
* Convert the start of daylight saving time to dststart.
*/
if ( tzinfo.DaylightDate.wYear == 0 )
cvtdate( 1,
1, /* day-in-month format */
tb->tm_year,
tzinfo.DaylightDate.wMonth,
tzinfo.DaylightDate.wDay,
tzinfo.DaylightDate.wDayOfWeek,
0,
tzinfo.DaylightDate.wHour,
tzinfo.DaylightDate.wMinute,
tzinfo.DaylightDate.wSecond,
tzinfo.DaylightDate.wMilliseconds );
else
cvtdate( 1,
0, /* absolute date */
tb->tm_year,
tzinfo.DaylightDate.wMonth,
0,
0,
tzinfo.DaylightDate.wDay,
tzinfo.DaylightDate.wHour,
tzinfo.DaylightDate.wMinute,
tzinfo.DaylightDate.wSecond,
tzinfo.DaylightDate.wMilliseconds );
/*
* Convert start of standard time to dstend.
*/
if ( tzinfo.StandardDate.wYear == 0 )
cvtdate( 0,
1, /* day-in-month format */
tb->tm_year,
tzinfo.StandardDate.wMonth,
tzinfo.StandardDate.wDay,
tzinfo.StandardDate.wDayOfWeek,
0,
tzinfo.StandardDate.wHour,
tzinfo.StandardDate.wMinute,
tzinfo.StandardDate.wSecond,
tzinfo.StandardDate.wMilliseconds );
else
cvtdate( 0,
0, /* absolute date */
tb->tm_year,
tzinfo.StandardDate.wMonth,
0,
0,
tzinfo.StandardDate.wDay,
tzinfo.StandardDate.wHour,
tzinfo.StandardDate.wMinute,
tzinfo.StandardDate.wSecond,
tzinfo.StandardDate.wMilliseconds );
}
else {
/*
* GetTimeZoneInformation API was NOT used, or failed. USA
* daylight saving time rules are assumed.
*/
cvtdate( 1,
1,
tb->tm_year,
4, /* April */
1, /* first... */
0, /* ...Sunday */
0,
2, /* 02:00 (2 AM) */
0,
0,
0 );
cvtdate( 0,
1,
tb->tm_year,
10, /* October */
5, /* last... */
0, /* ...Sunday */
0,
2, /* 02:00 (2 AM) */
0,
0,
0 );
}
}
/*
* Handle simple cases first.
*/
if ( dststart.yd < dstend.yd ) {
/*
* Northern hemisphere ordering
*/
if ( (tb->tm_yday < dststart.yd) || (tb->tm_yday > dstend.yd) )
return 0;
if ( (tb->tm_yday > dststart.yd) && (tb->tm_yday < dstend.yd) )
return 1;
}
else {
/*
* Southern hemisphere ordering
*/
if ( (tb->tm_yday < dstend.yd) || (tb->tm_yday > dststart.yd) )
return 1;
if ( (tb->tm_yday > dstend.yd) && (tb->tm_yday < dststart.yd) )
return 0;
}
ms = 1000L * (tb->tm_sec + 60L * tb->tm_min + 3600L * tb->tm_hour);
if ( tb->tm_yday == dststart.yd ) {
if ( ms >= dststart.ms )
return 1;
else
return 0;
}
else {
/*
* tb->tm_yday == dstend.yd
*/
if ( ms < dstend.ms )
return 1;
else
return 0;
}
}
#else /* _WIN32 */
#if defined (_M_MPPC) || defined (_M_M68K)
#include <cruntime.h>
#include <ctype.h>
#include <ctime.h>
#include <time.h>
#include <stdlib.h>
#include <internal.h>
#include <string.h>
#include <macos\script.h>
#include <macos\osutils.h>
/***
*void tzset() - sets timezone information and calc if in daylight time
*
*Purpose:
* Sets the timezone information from the TZ environment variable
* and then sets _timezone, _daylight, and _tzname. If we're in daylight
* time is automatically calculated.
*
*Entry:
* None, reads TZ environment variable.
*
*Exit:
* sets _daylight, _timezone, and _tzname global vars, no return value
*
*Exceptions:
*
*******************************************************************************/
void __cdecl _tzset (
void
)
{
REG1 char *TZ;
char *lastTZ=NULL;
MachineLocation ml;
long gmtDelta;
REG2 int negdiff = 0;
/*
* Fetch the value of the TZ environment variable. If there is no TZ
* environment variable, or if it is trivial, then the timezone
* information will be taken from the OS.
*/
if ( (TZ = getenv("TZ")) && (*TZ) ) {
/*
* TZ environment variable exists and is non-trivial. See if
* it is unchanged from a previous _tzset call.
*/
if ( (lastTZ == NULL) || (strcmp(TZ, lastTZ) != 0) ) {
/*
* TZ has changed, or there has been no prior _tzset call.
* Update lastTZ value.
*/
free(lastTZ);
lastTZ = _strdup(TZ);
}
else {
/*
* Timezone environment variable hasn't changed since the
* last _tzset call, just return.
*/
return;
}
}
else {
/*
* The TZ environment variable either does not exist, or is
* trivial. Therefore, timezone information will be obtained
* from the OS.
*/
if ( lastTZ != NULL ) {
free(lastTZ);
lastTZ = NULL;
}
ReadLocation(&ml);
//get gmtDelta from machinelocation in RAM
gmtDelta = ml.u.gmtDelta & 0x00ffffff;
if ((gmtDelta >> 23) & 1) //need to sign extend
gmtDelta = gmtDelta | 0xff000000;
//set timezone and daylight
_timezone = - gmtDelta;
_daylight = (ml.u.dlsDelta ? 1 : 0);
*_tzname[0] = '\0';
*_tzname[1] = '\0';
return;
}
strncpy(_tzname[0], TZ, 3);
/*
* time difference is of the form:
*
* [+|-]hh[:mm[:ss]]
*
* check minus sign first.
*/
if ( *(TZ += 3) == '-' ) {
negdiff++;
TZ++;
}
/*
* process, then skip over, the hours
*/
_timezone = atol(TZ) * 3600L;
while ( (*TZ == '+') || ((*TZ >= '0') && (*TZ <= '9')) ) TZ++;
/*
* check if minutes were specified
*/
if ( *TZ == ':' ) {
/*
* process, then skip over, the minutes
*/
_timezone += atol(++TZ) * 60L;
while ( (*TZ >= '0') && (*TZ <= '9') ) TZ++;
/*
* check if seconds were specified
*/
if ( *TZ == ':' ) {
/*
* process, then skip over, the seconds
*/
_timezone += atol(++TZ);
while ( (*TZ >= '0') && (*TZ <= '9') ) TZ++;
}
}
if ( negdiff )
_timezone = -_timezone;
/*
* finally, check for a DST zone suffix
*/
if (*TZ)
strncpy(_tzname[1], TZ, 3);
else
*_tzname[1] = '\0';
_daylight = *_tzname[1] != '\0';
}
/*
* _isindst - Tells whether Xenix-type time value falls under DST
*
* This is the rule for years before 1987:
* a time is in DST iff it is on or after 02:00:00 on the last Sunday
* in April and before 01:00:00 on the last Sunday in October.
* This is the rule for years starting with 1987:
* a time is in DST iff it is on or after 02:00:00 on the first Sunday
* in April and before 01:00:00 on the last Sunday in October.
*
* ENTRY tb - 'time' structure holding broken-down time value
*
* RETURN 1 if time represented is in DST, else 0
*/
int __cdecl _isindst (
REG1 struct tm *tb
)
{
int mdays;
REG2 int yr;
int lastsun;
/* If the month is before April or after October, then we know
* immediately it can't be DST. */
if (tb->tm_mon < 3 || tb->tm_mon > 9)
return(0);
/* If the month is after April and before October then we know
* immediately it must be DST. */
if (tb->tm_mon > 3 && tb->tm_mon < 9)
return(1);
/*
* Now for the hard part. Month is April or October; see if date
* falls between appropriate Sundays.
*/
/*
* The objective for years before 1987 (after 1986) is to determine
* if the day is on or after 2:00 am on the last (first) Sunday in
* April, or before 1:00 am on the last Sunday in October.
*
* We know the year-day (0..365) of the current time structure. We must
* determine the year-day of the last (first) Sunday in this month,
* April or October, and then do the comparison.
*
* To determine the year-day of the last Sunday, we do the following:
* 1. Get the year-day of the last day of the current month (Apr
* or Oct)
* 2. Determine the week-day number of #1,
* which is defined as 0 = Sun, 1 = Mon, ... 6 = Sat
* 3. Subtract #2 from #1
*
* To determine the year-day of the first Sunday, we do the following:
* 1. Get the year-day of the 7th day of the current month (April)
* 2. Determine the week-day number of #1,
* which is defined as 0 = Sun, 1 = Mon, ... 6 = Sat
* 3. Subtract #2 from #1
*/
yr = tb->tm_year + 1900; /* To see if this is a leap-year */
/* First we get #1. The year-days for each month are stored in _days[]
* they're all off by -1 */
if (yr > 1986 && tb->tm_mon == 3)
mdays = 7 + _days[tb->tm_mon];
else
mdays = _days[tb->tm_mon+1];
/* if this is a leap-year, add an extra day */
if (!(yr & 3))
mdays++;
/* mdays now has #1 */
yr = tb->tm_year - 70;
/* Now get #2. We know the week-day number of the beginning of the
* epoch, Jan. 1, 1970, which is defined as the constant _BASE_DOW. We
* then add the number of days that have passed from _BASE_DOW to the day
* of #2
* mdays + 365 * yr
* correct for the leap years which intervened
* + (yr + 1)/ 4
* and take the result mod 7, except that 0 must be mapped to 7.
* This is #2, which we then subtract from #1, mdays
*/
lastsun = mdays - ((mdays + 365*yr + ((yr+1)/4) + _BASE_DOW) % 7);
/* Now we know 1 and 3; we're golden: */
return (tb->tm_mon==3
? (tb->tm_yday > lastsun ||
(tb->tm_yday == lastsun && tb->tm_hour >= 2))
: (tb->tm_yday < lastsun ||
(tb->tm_yday == lastsun && tb->tm_hour < 1)));
}
#endif /* defined (_M_MPPC) || defined (_M_M68K) */
#endif /* _WIN32 */
@@ -0,0 +1,288 @@
/***
*winheap.h - Private include file for winheap directory.
*
* Copyright (c) 1988-1998, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Contains information needed by the C library heap code.
*
* [Internal]
*
****/
#if _MSC_VER > 1000
#pragma once
#endif /* _MSC_VER > 1000 */
#ifndef _INC_WINHEAP
#define _INC_WINHEAP
#ifndef _CRTBLD
/*
* This is an internal C runtime header file. It is used when building
* the C runtimes only. It is not to be used as a public header file.
*/
#error ERROR: Use of C runtime library internal header file.
#endif /* _CRTBLD */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <windows.h>
// Declarations and definitions for the multiple heap scheme (VC++ 6.1)
// Heap-selection constants
#define __SYSTEM_HEAP 1
#define __V5_HEAP 2
#define __V6_HEAP 3
#define __HEAP_ENV_STRING "__MSVCRT_HEAP_SELECT"
#define __GLOBAL_HEAP_SELECTOR "__GLOBAL_HEAP_SELECTED"
// Heap-selection global variable
extern int __active_heap;
// Linker info for heap selection
typedef struct {
union {
DWORD dw;
struct {
BYTE bverMajor;
BYTE bverMinor;
};
};
} LinkerVersion;
extern void __cdecl _GetLinkerVersion(LinkerVersion * plv);
// Definitions, declarations and prototypes for the small-block heap (VC++ 6.0)
#define BYTES_PER_PARA 16
#define DWORDS_PER_PARA 4
#define PARAS_PER_PAGE 256 // tunable value
#define PAGES_PER_GROUP 8 // tunable value
#define GROUPS_PER_REGION 32 // tunable value (max 32)
#define BYTES_PER_PAGE (BYTES_PER_PARA * PARAS_PER_PAGE)
#define BYTES_PER_GROUP (BYTES_PER_PAGE * PAGES_PER_GROUP)
#define BYTES_PER_REGION (BYTES_PER_GROUP * GROUPS_PER_REGION)
#define ENTRY_OFFSET 0x0000000cL // offset of entry in para
#define OVERHEAD_PER_PAGE 0x00000010L // sixteen bytes of overhead
#define MAX_FREE_ENTRY_SIZE (BYTES_PER_PAGE - OVERHEAD_PER_PAGE)
#define BITV_COMMIT_INIT (((1 << GROUPS_PER_REGION) - 1) << \
(32 - GROUPS_PER_REGION))
#define MAX_ALLOC_DATA_SIZE 0x3f8
#define MAX_ALLOC_ENTRY_SIZE (MAX_ALLOC_DATA_SIZE + 0x8)
typedef unsigned int BITVEC;
typedef struct tagListHead
{
struct tagEntry * pEntryNext;
struct tagEntry * pEntryPrev;
}
LISTHEAD, *PLISTHEAD;
typedef struct tagEntry
{
int sizeFront;
struct tagEntry * pEntryNext;
struct tagEntry * pEntryPrev;
}
ENTRY, *PENTRY;
typedef struct tagEntryEnd
{
int sizeBack;
}
ENTRYEND, *PENTRYEND;
typedef struct tagGroup
{
int cntEntries;
struct tagListHead listHead[64];
}
GROUP, *PGROUP;
typedef struct tagRegion
{
int indGroupUse;
char cntRegionSize[64];
BITVEC bitvGroupHi[GROUPS_PER_REGION];
BITVEC bitvGroupLo[GROUPS_PER_REGION];
struct tagGroup grpHeadList[GROUPS_PER_REGION];
}
REGION, *PREGION;
typedef struct tagHeader
{
BITVEC bitvEntryHi;
BITVEC bitvEntryLo;
BITVEC bitvCommit;
void * pHeapData;
struct tagRegion * pRegion;
}
HEADER, *PHEADER;
extern HANDLE _crtheap;
/*
* Global variable declarations for the small-block heap.
*/
extern size_t __sbh_threshold;
void * __cdecl _nh_malloc(size_t, int);
void * __cdecl _heap_alloc(size_t);
extern PHEADER __sbh_pHeaderList; // pointer to list start
extern PHEADER __sbh_pHeaderScan; // pointer to list rover
extern int __sbh_sizeHeaderList; // allocated size of list
extern int __sbh_cntHeaderList; // count of entries defined
extern PHEADER __sbh_pHeaderDefer;
extern int __sbh_indGroupDefer;
extern size_t __cdecl _get_sb_threshold(void);
extern int __cdecl _set_sb_threshold(size_t);
extern int __cdecl _heap_init(int);
extern void __cdecl _heap_term(void);
extern void * __cdecl _malloc_base(size_t);
extern void * __cdecl _nh_malloc_base(size_t, int);
extern void * __cdecl _heap_alloc_base(size_t);
extern void __cdecl _free_base(void *);
extern void * __cdecl _realloc_base(void *, size_t);
extern void * __cdecl _expand_base(void *, size_t);
extern void * __cdecl _calloc_base(size_t, size_t);
extern size_t __cdecl _msize_base(void *);
extern int __cdecl __sbh_heap_init(size_t);
extern void * __cdecl __sbh_alloc_block(int);
extern PHEADER __cdecl __sbh_alloc_new_region(void);
extern int __cdecl __sbh_alloc_new_group(PHEADER);
extern PHEADER __cdecl __sbh_find_block(void *);
#ifdef _DEBUG
extern int __cdecl __sbh_verify_block(PHEADER, void *);
#endif /* _DEBUG */
extern void __cdecl __sbh_free_block(PHEADER, void *);
extern int __cdecl __sbh_resize_block(PHEADER, void *, int);
extern void __cdecl __sbh_heapmin(void);
extern int __cdecl __sbh_heap_check(void);
// Definitions, declarations and prototypes for the old small-block heap
// (shipped with VC++ 5.0)
#ifdef _M_ALPHA
#define _OLD_PAGESIZE 0x2000 // one page
#else /* _M_ALPHA */
#define _OLD_PAGESIZE 0x1000 // one page
#endif /* _M_ALPHA */
// Constants and types used by the old small-block heap
#define _OLD_PARASIZE 0x10
#define _OLD_PARASHIFT 0x4
#ifdef _M_ALPHA
#define _OLD_PARAS_PER_PAGE 454
#define _OLD_PADDING_PER_PAGE 5
#define _OLD_PAGES_PER_REGION 512
#define _OLD_PAGES_PER_COMMITMENT 8
#else /* _M_ALPHA */
#define _OLD_PARAS_PER_PAGE 240
#define _OLD_PADDING_PER_PAGE 7
#define _OLD_PAGES_PER_REGION 1024
#define _OLD_PAGES_PER_COMMITMENT 16
#endif /* _M_ALPHA */
typedef char __old_para_t[16];
#ifdef _M_ALPHA
typedef unsigned short __old_page_map_t;
#else /* _M_ALPHA */
typedef unsigned char __old_page_map_t;
#endif /* _M_ALPHA */
#define _OLD_FREE_PARA (__old_page_map_t)(0)
#define _OLD_UNCOMMITTED_PAGE (-1)
#define _OLD_NO_FAILED_ALLOC (size_t)(_OLD_PARAS_PER_PAGE + 1)
// Small-block heap page. The first four fields of the structure below are
// descriptor for the page. That is, they hold information about allocations
// in the page. The last field (typed as an array of paragraphs) is the
// allocation area.
typedef struct __old_sbh_page_struct {
__old_page_map_t * p_starting_alloc_map;
size_t free_paras_at_start;
__old_page_map_t alloc_map[_OLD_PARAS_PER_PAGE + 1];
__old_page_map_t reserved[_OLD_PADDING_PER_PAGE];
__old_para_t alloc_blocks[_OLD_PARAS_PER_PAGE];
} __old_sbh_page_t;
#define _OLD_NO_PAGES (__old_sbh_page_t *)0xFFFFFFFF
// Type used in small block region desciptor type (see below).
typedef struct {
int free_paras_in_page;
size_t last_failed_alloc;
} __old_region_map_t;
// Small-block heap region descriptor. Most often, the small-block heap
// consists of a single region, described by the statically allocated
// decriptor __small_block_heap (declared below).
struct __old_sbh_region_struct {
struct __old_sbh_region_struct *p_next_region;
struct __old_sbh_region_struct *p_prev_region;
__old_region_map_t * p_starting_region_map;
__old_region_map_t * p_first_uncommitted;
__old_sbh_page_t * p_pages_begin;
__old_sbh_page_t * p_pages_end;
__old_region_map_t region_map[_OLD_PAGES_PER_REGION + 1];
};
typedef struct __old_sbh_region_struct __old_sbh_region_t;
// Global variable declarations for the old small-block heap.
extern __old_sbh_region_t __old_small_block_heap;
extern size_t __old_sbh_threshold;
// Prototypes for internal functions of the old small-block heap.
void * __cdecl __old_sbh_alloc_block(size_t);
void * __cdecl __old_sbh_alloc_block_from_page(__old_sbh_page_t *, size_t,
size_t);
void __cdecl __old_sbh_decommit_pages(int);
__old_page_map_t * __cdecl __old_sbh_find_block(void *, __old_sbh_region_t **,
__old_sbh_page_t **);
void __cdecl __old_sbh_free_block(__old_sbh_region_t *, __old_sbh_page_t *,
__old_page_map_t *);
int __cdecl __old_sbh_heap_check(void);
__old_sbh_region_t * __cdecl __old_sbh_new_region(void);
void __cdecl __old_sbh_release_region(__old_sbh_region_t *);
int __cdecl __old_sbh_resize_block(__old_sbh_region_t *,
__old_sbh_page_t *, __old_page_map_t *, size_t);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _INC_WINHEAP */
+659
View File
@@ -0,0 +1,659 @@
// tree internal header
#if _MSC_VER > 1000 /*IFSTRIP=IGN*/
#pragma once
#endif
#ifndef _XTREE_
#define _XTREE_
#include <cstddef>
#include <iterator>
#include <memory>
#include <xutility>
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
_STD_BEGIN
// TEMPLATE CLASS _Tree
template<class _K, class _Ty, class _Kfn, class _Pr, class _A>
class _Tree {
protected:
enum _Redbl {_Red, _Black};
struct _Node;
friend struct _Node;
typedef _POINTER_X(_Node, _A) _Nodeptr;
struct _Node {
_Nodeptr _Left, _Parent, _Right;
_Ty _Value;
_Redbl _Color;
};
typedef _REFERENCE_X(_Nodeptr, _A) _Nodepref;
typedef _REFERENCE_X(const _K, _A) _Keyref;
typedef _REFERENCE_X(_Redbl, _A) _Rbref;
typedef _REFERENCE_X(_Ty, _A) _Vref;
static _Rbref _Color(_Nodeptr _P)
{return ((_Rbref)(*_P)._Color); }
static _Keyref _Key(_Nodeptr _P)
{return (_Kfn()(_Value(_P))); }
static _Nodepref _Left(_Nodeptr _P)
{return ((_Nodepref)(*_P)._Left); }
static _Nodepref _Parent(_Nodeptr _P)
{return ((_Nodepref)(*_P)._Parent); }
static _Nodepref _Right(_Nodeptr _P)
{return ((_Nodepref)(*_P)._Right); }
static _Vref _Value(_Nodeptr _P)
{return ((_Vref)(*_P)._Value); }
public:
typedef _Tree<_K, _Ty, _Kfn, _Pr, _A> _Myt;
typedef _K key_type;
typedef _Ty value_type;
typedef _A::size_type size_type;
typedef _A::difference_type difference_type;
typedef _POINTER_X(_Ty, _A) _Tptr;
typedef _POINTER_X(const _Ty, _A) _Ctptr;
typedef _REFERENCE_X(_Ty, _A) reference;
typedef _REFERENCE_X(const _Ty, _A) const_reference;
// CLASS const_iterator
class iterator;
class const_iterator;
friend class const_iterator;
class const_iterator : public _Bidit<_Ty, difference_type> {
public:
const_iterator()
{}
const_iterator(_Nodeptr _P)
: _Ptr(_P) {}
const_iterator(const iterator& _X)
: _Ptr(_X._Ptr) {}
const_reference operator*() const
{return (_Value(_Ptr)); }
_Ctptr operator->() const
{return (&**this); }
const_iterator& operator++()
{_Inc();
return (*this); }
const_iterator operator++(int)
{const_iterator _Tmp = *this;
++*this;
return (_Tmp); }
const_iterator& operator--()
{_Dec();
return (*this); }
const_iterator operator--(int)
{const_iterator _Tmp = *this;
--*this;
return (_Tmp); }
bool operator==(const const_iterator& _X) const
{return (_Ptr == _X._Ptr); }
bool operator!=(const const_iterator& _X) const
{return (!(*this == _X)); }
void _Dec()
{if (_Color(_Ptr) == _Red
&& _Parent(_Parent(_Ptr)) == _Ptr)
_Ptr = _Right(_Ptr);
else if (_Left(_Ptr) != _Nil)
_Ptr = _Max(_Left(_Ptr));
else
{_Nodeptr _P;
while (_Ptr == _Left(_P = _Parent(_Ptr)))
_Ptr = _P;
_Ptr = _P; }}
void _Inc()
{if (_Right(_Ptr) != _Nil)
_Ptr = _Min(_Right(_Ptr));
else
{_Nodeptr _P;
while (_Ptr == _Right(_P = _Parent(_Ptr)))
_Ptr = _P;
if (_Right(_Ptr) != _P)
_Ptr = _P; }}
_Nodeptr _Mynode() const
{return (_Ptr); }
protected:
_Nodeptr _Ptr;
};
// CLASS iterator
friend class iterator;
class iterator : public const_iterator {
public:
iterator()
{}
iterator(_Nodeptr _P)
: const_iterator(_P) {}
reference operator*() const
{return (_Value(_Ptr)); }
_Tptr operator->() const
{return (&**this); }
iterator& operator++()
{_Inc();
return (*this); }
iterator operator++(int)
{iterator _Tmp = *this;
++*this;
return (_Tmp); }
iterator& operator--()
{_Dec();
return (*this); }
iterator operator--(int)
{iterator _Tmp = *this;
--*this;
return (_Tmp); }
bool operator==(const iterator& _X) const
{return (_Ptr == _X._Ptr); }
bool operator!=(const iterator& _X) const
{return (!(*this == _X)); }
};
typedef reverse_bidirectional_iterator<iterator,
value_type, reference, _Tptr, difference_type>
reverse_iterator;
typedef reverse_bidirectional_iterator<const_iterator,
value_type, const_reference, _Ctptr, difference_type>
const_reverse_iterator;
typedef pair<iterator, bool> _Pairib;
typedef pair<iterator, iterator> _Pairii;
typedef pair<const_iterator, const_iterator> _Paircc;
explicit _Tree(const _Pr& _Parg, bool _Marg = true,
const _A& _Al = _A())
: allocator(_Al),
key_compare(_Parg), _Multi(_Marg)
{_Init(); }
_Tree(const _Ty *_F, const _Ty *_L,
const _Pr& _Parg, bool _Marg = true,
const _A& _Al = _A())
: allocator(_Al),
key_compare(_Parg), _Multi(_Marg)
{_Init();
insert(_F, _L); }
_Tree(const _Myt& _X)
: allocator(_X.allocator),
key_compare(_X.key_compare), _Multi(_X._Multi)
{_Init();
_Copy(_X); }
~_Tree()
{erase(begin(), end());
_Freenode(_Head);
_Head = 0, _Size = 0;
_Nodeptr _Tmp = 0;
{_Lockit _Lk;
if (--_Nilrefs == 0)
{_Tmp = _Nil;
_Nil = 0; }}
if (_Tmp != 0)
_Freenode(_Tmp); }
_Myt& operator=(const _Myt& _X)
{if (this != &_X)
{erase(begin(), end());
key_compare = _X.key_compare;
_Copy(_X); }
return (*this); }
iterator begin()
{return (iterator(_Lmost())); }
const_iterator begin() const
{return (const_iterator(_Lmost())); }
iterator end()
{return (iterator(_Head)); }
const_iterator end() const
{return (const_iterator(_Head)); }
reverse_iterator rbegin()
{return (reverse_iterator(end())); }
const_reverse_iterator rbegin() const
{return (const_reverse_iterator(end())); }
reverse_iterator rend()
{return (reverse_iterator(begin())); }
const_reverse_iterator rend() const
{return (const_reverse_iterator(begin())); }
size_type size() const
{return (_Size); }
size_type max_size() const
{return (allocator.max_size()); }
bool empty() const
{return (size() == 0); }
_A get_allocator() const
{return (allocator); }
_Pr key_comp() const
{return (key_compare); }
_Pairib insert(const value_type& _V)
{_Nodeptr _X = _Root();
_Nodeptr _Y = _Head;
bool _Ans = true;
while (_X != _Nil)
{_Y = _X;
_Ans = key_compare(_Kfn()(_V), _Key(_X));
_X = _Ans ? _Left(_X) : _Right(_X); }
if (_Multi)
return (_Pairib(_Insert(_X, _Y, _V), true));
iterator _P = iterator(_Y);
if (!_Ans)
;
else if (_P == begin())
return (_Pairib(_Insert(_X, _Y, _V), true));
else
--_P;
if (key_compare(_Key(_P._Mynode()), _Kfn()(_V)))
return (_Pairib(_Insert(_X, _Y, _V), true));
return (_Pairib(_P, false)); }
iterator insert(iterator _P, const value_type& _V)
{if (size() == 0)
;
else if (_P == begin())
{if (key_compare(_Kfn()(_V), _Key(_P._Mynode())))
return (_Insert(_Head, _P._Mynode(), _V)); }
else if (_P == end())
{if (key_compare(_Key(_Rmost()), _Kfn()(_V)))
return (_Insert(_Nil, _Rmost(), _V)); }
else
{iterator _Pb = _P;
if (key_compare(_Key((--_Pb)._Mynode()), _Kfn()(_V))
&& key_compare(_Kfn()(_V), _Key(_P._Mynode())))
{if (_Right(_Pb._Mynode()) == _Nil)
return (_Insert(_Nil, _Pb._Mynode(), _V));
else
return (_Insert(_Head, _P._Mynode(), _V)); }}
return (insert(_V).first); }
void insert(iterator _F, iterator _L)
{for (; _F != _L; ++_F)
insert(*_F); }
void insert(const value_type *_F, const value_type *_L)
{for (; _F != _L; ++_F)
insert(*_F); }
iterator erase(iterator _P)
{_Nodeptr _X;
_Nodeptr _Y = (_P++)._Mynode();
_Nodeptr _Z = _Y;
if (_Left(_Y) == _Nil)
_X = _Right(_Y);
else if (_Right(_Y) == _Nil)
_X = _Left(_Y);
else
_Y = _Min(_Right(_Y)), _X = _Right(_Y);
{ _Lockit _Lk;
if (_Y != _Z)
{_Parent(_Left(_Z)) = _Y;
_Left(_Y) = _Left(_Z);
if (_Y == _Right(_Z))
_Parent(_X) = _Y;
else
{_Parent(_X) = _Parent(_Y);
_Left(_Parent(_Y)) = _X;
_Right(_Y) = _Right(_Z);
_Parent(_Right(_Z)) = _Y; }
if (_Root() == _Z)
_Root() = _Y;
else if (_Left(_Parent(_Z)) == _Z)
_Left(_Parent(_Z)) = _Y;
else
_Right(_Parent(_Z)) = _Y;
_Parent(_Y) = _Parent(_Z);
std::swap(_Color(_Y), _Color(_Z));
_Y = _Z; }
else
{_Parent(_X) = _Parent(_Y);
if (_Root() == _Z)
_Root() = _X;
else if (_Left(_Parent(_Z)) == _Z)
_Left(_Parent(_Z)) = _X;
else
_Right(_Parent(_Z)) = _X;
if (_Lmost() != _Z)
;
else if (_Right(_Z) == _Nil)
_Lmost() = _Parent(_Z);
else
_Lmost() = _Min(_X);
if (_Rmost() != _Z)
;
else if (_Left(_Z) == _Nil)
_Rmost() = _Parent(_Z);
else
_Rmost() = _Max(_X); }
if (_Color(_Y) == _Black)
{while (_X != _Root() && _Color(_X) == _Black)
if (_X == _Left(_Parent(_X)))
{_Nodeptr _W = _Right(_Parent(_X));
if (_Color(_W) == _Red)
{_Color(_W) = _Black;
_Color(_Parent(_X)) = _Red;
_Lrotate(_Parent(_X));
_W = _Right(_Parent(_X)); }
if (_Color(_Left(_W)) == _Black
&& _Color(_Right(_W)) == _Black)
{_Color(_W) = _Red;
_X = _Parent(_X); }
else
{if (_Color(_Right(_W)) == _Black)
{_Color(_Left(_W)) = _Black;
_Color(_W) = _Red;
_Rrotate(_W);
_W = _Right(_Parent(_X)); }
_Color(_W) = _Color(_Parent(_X));
_Color(_Parent(_X)) = _Black;
_Color(_Right(_W)) = _Black;
_Lrotate(_Parent(_X));
break; }}
else
{_Nodeptr _W = _Left(_Parent(_X));
if (_Color(_W) == _Red)
{_Color(_W) = _Black;
_Color(_Parent(_X)) = _Red;
_Rrotate(_Parent(_X));
_W = _Left(_Parent(_X)); }
if (_Color(_Right(_W)) == _Black
&& _Color(_Left(_W)) == _Black)
{_Color(_W) = _Red;
_X = _Parent(_X); }
else
{if (_Color(_Left(_W)) == _Black)
{_Color(_Right(_W)) = _Black;
_Color(_W) = _Red;
_Lrotate(_W);
_W = _Left(_Parent(_X)); }
_Color(_W) = _Color(_Parent(_X));
_Color(_Parent(_X)) = _Black;
_Color(_Left(_W)) = _Black;
_Rrotate(_Parent(_X));
break; }}
_Color(_X) = _Black; }
}
_Destval(&_Value(_Y));
_Freenode(_Y);
--_Size;
return (_P); }
iterator erase(iterator _F, iterator _L)
{if (size() == 0 || _F != begin() || _L != end())
{while (_F != _L)
erase(_F++);
return (_F); }
else
{_Erase(_Root());
_Root() = _Nil, _Size = 0;
_Lmost() = _Head, _Rmost() = _Head;
return (begin()); }}
size_type erase(const _K& _X)
{_Pairii _P = equal_range(_X);
size_type _N = 0;
_Distance(_P.first, _P.second, _N);
erase(_P.first, _P.second);
return (_N); }
void erase(const _K *_F, const _K *_L)
{for (; _F != _L; ++_F)
erase(*_F); }
void clear()
{erase(begin(), end()); }
iterator find(const _K& _Kv)
{iterator _P = lower_bound(_Kv);
return (_P == end()
|| key_compare(_Kv, _Key(_P._Mynode()))
? end() : _P); }
const_iterator find(const _K& _Kv) const
{const_iterator _P = lower_bound(_Kv);
return (_P == end()
|| key_compare(_Kv, _Key(_P._Mynode()))
? end() : _P); }
size_type count(const _K& _Kv) const
{_Paircc _Ans = equal_range(_Kv);
size_type _N = 0;
_Distance(_Ans.first, _Ans.second, _N);
return (_N); }
iterator lower_bound(const _K& _Kv)
{return (iterator(_Lbound(_Kv))); }
const_iterator lower_bound(const _K& _Kv) const
{return (const_iterator(_Lbound(_Kv))); }
iterator upper_bound(const _K& _Kv)
{return (iterator(_Ubound(_Kv))); }
const_iterator upper_bound(const _K& _Kv) const
{return (iterator(_Ubound(_Kv))); }
_Pairii equal_range(const _K& _Kv)
{return (_Pairii(lower_bound(_Kv), upper_bound(_Kv))); }
_Paircc equal_range(const _K& _Kv) const
{return (_Paircc(lower_bound(_Kv), upper_bound(_Kv))); }
void swap(_Myt& _X)
{std::swap(key_compare, _X.key_compare);
if (allocator == _X.allocator)
{std::swap(_Head, _X._Head);
std::swap(_Multi, _X._Multi);
std::swap(_Size, _X._Size); }
else
{_Myt _Ts = *this; *this = _X, _X = _Ts; }}
friend void swap(_Myt& _X, _Myt& _Y)
{_X.swap(_Y); }
protected:
static _Nodeptr _Nil;
static size_t _Nilrefs;
void _Copy(const _Myt& _X)
{_Root() = _Copy(_X._Root(), _Head);
_Size = _X.size();
if (_Root() != _Nil)
{_Lmost() = _Min(_Root());
_Rmost() = _Max(_Root()); }
else
_Lmost() = _Head, _Rmost() = _Head; }
_Nodeptr _Copy(_Nodeptr _X, _Nodeptr _P)
{_Nodeptr _R = _X;
for (; _X != _Nil; _X = _Left(_X))
{_Nodeptr _Y = _Buynode(_P, _Color(_X));
if (_R == _X)
_R = _Y;
_Right(_Y) = _Copy(_Right(_X), _Y);
_Consval(&_Value(_Y), _Value(_X));
_Left(_P) = _Y;
_P = _Y; }
_Left(_P) = _Nil;
return (_R); }
void _Erase(_Nodeptr _X)
{for (_Nodeptr _Y = _X; _Y != _Nil; _X = _Y)
{_Erase(_Right(_Y));
_Y = _Left(_Y);
_Destval(&_Value(_X));
_Freenode(_X); }}
void _Init()
{_Nodeptr _Tmp = _Buynode(0, _Black);
{_Lockit _Lk;
if (_Nil == 0)
{_Nil = _Tmp;
_Tmp = 0;
_Left(_Nil) = 0, _Right(_Nil) = 0; }
++_Nilrefs; }
if (_Tmp != 0)
_Freenode(_Tmp);
_Head = _Buynode(_Nil, _Red), _Size = 0;
_Lmost() = _Head, _Rmost() = _Head; }
iterator _Insert(_Nodeptr _X, _Nodeptr _Y, const _Ty& _V)
{_Nodeptr _Z = _Buynode(_Y, _Red);
_Left(_Z) = _Nil, _Right(_Z) = _Nil;
_Consval(&_Value(_Z), _V);
++_Size;
if (_Y == _Head || _X != _Nil
|| key_compare(_Kfn()(_V), _Key(_Y)))
{_Left(_Y) = _Z;
if (_Y == _Head)
{_Root() = _Z;
_Rmost() = _Z; }
else if (_Y == _Lmost())
_Lmost() = _Z; }
else
{_Right(_Y) = _Z;
if (_Y == _Rmost())
_Rmost() = _Z; }
for (_X = _Z; _X != _Root()
&& _Color(_Parent(_X)) == _Red; )
if (_Parent(_X) == _Left(_Parent(_Parent(_X))))
{_Y = _Right(_Parent(_Parent(_X)));
if (_Color(_Y) == _Red)
{_Color(_Parent(_X)) = _Black;
_Color(_Y) = _Black;
_Color(_Parent(_Parent(_X))) = _Red;
_X = _Parent(_Parent(_X)); }
else
{if (_X == _Right(_Parent(_X)))
{_X = _Parent(_X);
_Lrotate(_X); }
_Color(_Parent(_X)) = _Black;
_Color(_Parent(_Parent(_X))) = _Red;
_Rrotate(_Parent(_Parent(_X))); }}
else
{_Y = _Left(_Parent(_Parent(_X)));
if (_Color(_Y) == _Red)
{_Color(_Parent(_X)) = _Black;
_Color(_Y) = _Black;
_Color(_Parent(_Parent(_X))) = _Red;
_X = _Parent(_Parent(_X)); }
else
{if (_X == _Left(_Parent(_X)))
{_X = _Parent(_X);
_Rrotate(_X); }
_Color(_Parent(_X)) = _Black;
_Color(_Parent(_Parent(_X))) = _Red;
_Lrotate(_Parent(_Parent(_X))); }}
_Color(_Root()) = _Black;
return (iterator(_Z)); }
_Nodeptr _Lbound(const _K& _Kv) const
{_Nodeptr _X = _Root();
_Nodeptr _Y = _Head;
while (_X != _Nil)
if (key_compare(_Key(_X), _Kv))
_X = _Right(_X);
else
_Y = _X, _X = _Left(_X);
return (_Y); }
_Nodeptr& _Lmost()
{return (_Left(_Head)); }
_Nodeptr& _Lmost() const
{return (_Left(_Head)); }
void _Lrotate(_Nodeptr _X)
{_Nodeptr _Y = _Right(_X);
_Right(_X) = _Left(_Y);
if (_Left(_Y) != _Nil)
_Parent(_Left(_Y)) = _X;
_Parent(_Y) = _Parent(_X);
if (_X == _Root())
_Root() = _Y;
else if (_X == _Left(_Parent(_X)))
_Left(_Parent(_X)) = _Y;
else
_Right(_Parent(_X)) = _Y;
_Left(_Y) = _X;
_Parent(_X) = _Y; }
static _Nodeptr _Max(_Nodeptr _P)
{while (_Right(_P) != _Nil)
_P = _Right(_P);
return (_P); }
static _Nodeptr _Min(_Nodeptr _P)
{while (_Left(_P) != _Nil)
_P = _Left(_P);
return (_P); }
_Nodeptr& _Rmost()
{return (_Right(_Head)); }
_Nodeptr& _Rmost() const
{return (_Right(_Head)); }
_Nodeptr& _Root()
{return (_Parent(_Head)); }
_Nodeptr& _Root() const
{return (_Parent(_Head)); }
void _Rrotate(_Nodeptr _X)
{_Nodeptr _Y = _Left(_X);
_Left(_X) = _Right(_Y);
if (_Right(_Y) != _Nil)
_Parent(_Right(_Y)) = _X;
_Parent(_Y) = _Parent(_X);
if (_X == _Root())
_Root() = _Y;
else if (_X == _Right(_Parent(_X)))
_Right(_Parent(_X)) = _Y;
else
_Left(_Parent(_X)) = _Y;
_Right(_Y) = _X;
_Parent(_X) = _Y; }
_Nodeptr _Ubound(const _K& _Kv) const
{_Nodeptr _X = _Root();
_Nodeptr _Y = _Head;
while (_X != _Nil)
if (key_compare(_Kv, _Key(_X)))
_Y = _X, _X = _Left(_X);
else
_X = _Right(_X);
return (_Y); }
_Nodeptr _Buynode(_Nodeptr _Parg, _Redbl _Carg)
{_Nodeptr _S = (_Nodeptr)allocator._Charalloc(
1 * sizeof (_Node));
_Parent(_S) = _Parg;
_Color(_S) = _Carg;
return (_S); }
void _Consval(_Tptr _P, const _Ty& _V)
{_Construct(&*_P, _V); }
void _Destval(_Tptr _P)
{_Destroy(&*_P); }
void _Freenode(_Nodeptr _S)
{allocator.deallocate(_S, 1); }
_A allocator;
_Pr key_compare;
_Nodeptr _Head;
bool _Multi;
size_type _Size;
};
template<class _K, class _Ty, class _Kfn, class _Pr, class _A>
_Tree<_K, _Ty, _Kfn, _Pr, _A>::_Nodeptr
_Tree<_K, _Ty, _Kfn, _Pr, _A>::_Nil = 0;
template<class _K, class _Ty, class _Kfn, class _Pr, class _A>
size_t _Tree<_K, _Ty, _Kfn, _Pr, _A>::_Nilrefs = 0;
// tree TEMPLATE OPERATORS
template<class _K, class _Ty, class _Kfn,
class _Pr, class _A> inline
bool operator==(const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _X,
const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _Y)
{return (_X.size() == _Y.size()
&& equal(_X.begin(), _X.end(), _Y.begin())); }
template<class _K, class _Ty, class _Kfn,
class _Pr, class _A> inline
bool operator!=(const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _X,
const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _Y)
{return (!(_X == _Y)); }
template<class _K, class _Ty, class _Kfn,
class _Pr, class _A> inline
bool operator<(const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _X,
const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _Y)
{return (lexicographical_compare(_X.begin(), _X.end(),
_Y.begin(), _Y.end())); }
template<class _K, class _Ty, class _Kfn,
class _Pr, class _A> inline
bool operator>(const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _X,
const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _Y)
{return (_Y < _X); }
template<class _K, class _Ty, class _Kfn,
class _Pr, class _A> inline
bool operator<=(const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _X,
const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _Y)
{return (!(_Y < _X)); }
template<class _K, class _Ty, class _Kfn,
class _Pr, class _A> inline
bool operator>=(const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _X,
const _Tree<_K, _Ty, _Kfn, _Pr, _A>& _Y)
{return (!(_X < _Y)); }
_STD_END
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _XTREE_ */
/*
* Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED.
* Consult your license regarding permissions and restrictions.
*/
/*
* This file is derived from software bearing the following
* restrictions:
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this
* software and its documentation for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Hewlett-Packard Company makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*/
@@ -0,0 +1,628 @@
//+-------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1993-1997.
//
// File: accctrl.h
//
// Contents: common includes for new style Win32 Access Control
// APIs
//
//
//--------------------------------------------------------------------
#ifndef __ACCESS_CONTROL__
#define __ACCESS_CONTROL__
#ifndef __midl
#include <wtypes.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define AccFree LocalFree
//
// Definition: TRUSTEE_TYPE
// This enumerated type specifies the type of trustee account for the trustee
// returned by the API described in this document.
// TRUSTEE_IS_UNKNOWN - The trustee is an unknown, but not necessarily invalid
// type. This field is not validated on input to the APIs
// that take Trustees.
// TRUSTEE_IS_USER The trustee account is a user account.
// TRUSTEE_IS_GROUP The trustee account is a group account.
//
typedef enum _TRUSTEE_TYPE
{
TRUSTEE_IS_UNKNOWN,
TRUSTEE_IS_USER,
TRUSTEE_IS_GROUP,
TRUSTEE_IS_DOMAIN,
TRUSTEE_IS_ALIAS,
TRUSTEE_IS_WELL_KNOWN_GROUP,
TRUSTEE_IS_DELETED,
TRUSTEE_IS_INVALID,
} TRUSTEE_TYPE;
//
// Definition: TRUSTEE_FORM
// This enumerated type specifies the form the trustee identifier is in for a
// particular trustee.
// TRUSTEE_IS_SID The trustee is identified with a SID rather than with a name.
// TRUSTEE_IS_NAME The trustee is identified with a name.
//
typedef enum _TRUSTEE_FORM
{
TRUSTEE_IS_SID,
TRUSTEE_IS_NAME,
TRUSTEE_BAD_FORM
} TRUSTEE_FORM;
//
// Definition: MULTIPLE_TRUSTEE_OPERATION
// If the trustee is a multiple trustee, this enumerated type specifies the type.
// TRUSTEE_IS_IMPERSONATE The trustee is an impersonate trustee and the multiple
// trustee field in the trustee points to another trustee
// that is a trustee for the server that will be doing the
// impersonation.
//
typedef enum _MULTIPLE_TRUSTEE_OPERATION
{
NO_MULTIPLE_TRUSTEE,
TRUSTEE_IS_IMPERSONATE,
} MULTIPLE_TRUSTEE_OPERATION;
//
// Definition: TRUSTEE
// This structure is used to pass account information into and out of the system
// using the API defined in this document.
// PMultipleTrustee - if NON-NULL, points to another trustee structure, as
// defined by the multiple trustee operation field.
// MultipleTrusteeOperation - Defines the multiple trustee operation/type.
// TrusteeForm - defines if the trustee is defined by name or SID.
// TrusteeType - defines if the trustee type is unknown, a user or a group.
// PwcsName - points to the trustee name or the trustee SID.
//
typedef struct _TRUSTEE_A
{
struct _TRUSTEE_A *pMultipleTrustee;
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation;
TRUSTEE_FORM TrusteeForm;
TRUSTEE_TYPE TrusteeType;
#ifdef __midl
[switch_is(TrusteeForm)]
union
{
[case(TRUSTEE_IS_NAME)]
LPSTR ptstrName;
[case(TRUSTEE_IS_SID)]
SID *pSid;
};
#else
LPSTR ptstrName;
#endif
} TRUSTEE_A, *PTRUSTEE_A, TRUSTEEA, *PTRUSTEEA;
typedef struct _TRUSTEE_W
{
struct _TRUSTEE_W *pMultipleTrustee;
MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation;
TRUSTEE_FORM TrusteeForm;
TRUSTEE_TYPE TrusteeType;
#ifdef __midl
[switch_is(TrusteeForm)]
union
{
[case(TRUSTEE_IS_NAME)]
LPWSTR ptstrName;
[case(TRUSTEE_IS_SID)]
SID *pSid;
};
#else
LPWSTR ptstrName;
#endif
} TRUSTEE_W, *PTRUSTEE_W, TRUSTEEW, *PTRUSTEEW;
#ifdef UNICODE
typedef TRUSTEE_W TRUSTEE_;
typedef PTRUSTEE_W PTRUSTEE_;
typedef TRUSTEEW TRUSTEE;
typedef PTRUSTEEW PTRUSTEE;
#else
typedef TRUSTEE_A TRUSTEE_;
typedef PTRUSTEE_A PTRUSTEE_;
typedef TRUSTEEA TRUSTEE;
typedef PTRUSTEEA PTRUSTEE;
#endif // UNICODE
//
// Definition: ACCESS_MODE
// This enumerated type specifies how permissions are (requested)/to be applied
// for the trustee by the access control entry. On input this field can by any
// of the values, although it is not meaningful to mix access control and audit
// control entries. On output this field will be either SET_ACCESS, DENY_ACCESS,
// SET_AUDIT_SUCCESS, SET_AUDIT_FAILURE.
// The following descriptions define how this type effects an explicit access
// request to apply access permissions to an object.
// GRANT_ACCESS - The trustee will have at least the requested permissions upon
// successful completion of the command. (If the trustee has
// additional permissions they will not be removed).
// SET_ACCESS - The trustee will have exactly the requested permissions upon
// successful completion of the command.
// DENY_ACCESS - The trustee will be denied the specified permissions.
// REVOKE_ACCESS - Any explicit access rights the trustee has will be revoked.
// SET_AUDIT_SUCCESS - The trustee will be audited for successful opens of the
// object using the requested permissions.
// SET_AUDIT_FAILURE - The trustee will be audited for failed opens of the object
// using the requested permissions.
//
typedef enum _ACCESS_MODE
{
NOT_USED_ACCESS = 0,
GRANT_ACCESS,
SET_ACCESS,
DENY_ACCESS,
REVOKE_ACCESS,
SET_AUDIT_SUCCESS,
SET_AUDIT_FAILURE
} ACCESS_MODE;
//
// Definition: Inheritance flags
// These bit masks are provided to allow simple application of inheritance in
// explicit access requests on containers.
// NO_INHERITANCE The specific access permissions will only be applied to
// the container, and will not be inherited by objects created
// within the container.
// SUB_CONTAINERS_ONLY_INHERIT The specific access permissions will be inherited
// and applied to sub containers created within the
// container, and will be applied to the container
// itself.
// SUB_OBJECTS_ONLY_INHERIT The specific access permissions will only be inherited
// by objects created within the specific container.
// The access permissions will not be applied to the
// container itself.
// SUB_CONTAINERS_AND_OBJECTS_INHERIT The specific access permissions will be
// inherited by containers created within the
// specific container, will be applied to
// objects created within the container, but
// will not be applied to the container itself.
//
#define NO_INHERITANCE 0x0
#define SUB_OBJECTS_ONLY_INHERIT 0x1
#define SUB_CONTAINERS_ONLY_INHERIT 0x2
#define SUB_CONTAINERS_AND_OBJECTS_INHERIT 0x3
#define INHERIT_NO_PROPAGATE 0x4
#define INHERIT_ONLY 0x8
//
// Informational bit that is returned
//
#define INHERITED_ACCESS_ENTRY 0x10
//
// Informational bit that tells where a node was inherited from. Valid only
// for NT 5 APIs
//
#define INHERITED_PARENT 0x10000000
#define INHERITED_GRANDPARENT 0x20000000
//
// Definition:
// This enumerated type defines the objects supported by the get/set API within
// this document. See section 3.1, Object Types for a detailed definition of the
// supported object types, and their name formats.
//
typedef enum _SE_OBJECT_TYPE
{
SE_UNKNOWN_OBJECT_TYPE = 0,
SE_FILE_OBJECT,
SE_SERVICE,
SE_PRINTER,
SE_REGISTRY_KEY,
SE_LMSHARE,
SE_KERNEL_OBJECT,
SE_WINDOW_OBJECT,
SE_DS_OBJECT,
SE_DS_OBJECT_ALL,
SE_PROVIDER_DEFINED_OBJECT
} SE_OBJECT_TYPE;
//
// Definition: EXPLICIT_ACCESS
// This structure is used to pass access control entry information into and out
// of the system using the API defined in this document.
// grfAccessPermissions - This contains the access permissions to assign for the
// trustee. It is in the form of an NT access mask.
// grfAccessMode - This field defines how the permissions are to be applied for
// the trustee.
// grfInheritance - For containers, this field defines how the access control
// entry is/(is requested) to be inherited on
// objects/sub-containers created within the container.
// Trustee - This field contains the definition of the trustee account the
// explicit access applies to.
//
typedef struct _EXPLICIT_ACCESS_A
{
DWORD grfAccessPermissions;
ACCESS_MODE grfAccessMode;
DWORD grfInheritance;
TRUSTEE_A Trustee;
} EXPLICIT_ACCESS_A, *PEXPLICIT_ACCESS_A, EXPLICIT_ACCESSA, *PEXPLICIT_ACCESSA;
typedef struct _EXPLICIT_ACCESS_W
{
DWORD grfAccessPermissions;
ACCESS_MODE grfAccessMode;
DWORD grfInheritance;
TRUSTEE_W Trustee;
} EXPLICIT_ACCESS_W, *PEXPLICIT_ACCESS_W, EXPLICIT_ACCESSW, *PEXPLICIT_ACCESSW;
#ifdef UNICODE
typedef EXPLICIT_ACCESS_W EXPLICIT_ACCESS_;
typedef PEXPLICIT_ACCESS_W PEXPLICIT_ACCESS_;
typedef EXPLICIT_ACCESSW EXPLICIT_ACCESS;
typedef PEXPLICIT_ACCESSW PEXPLICIT_ACCESS;
#else
typedef EXPLICIT_ACCESS_A EXPLICIT_ACCESS_;
typedef PEXPLICIT_ACCESS_A PEXPLICIT_ACCESS_;
typedef EXPLICIT_ACCESSA EXPLICIT_ACCESS;
typedef PEXPLICIT_ACCESSA PEXPLICIT_ACCESS;
#endif // UNICODE
//----------------------------------------------------------------------------
//
// NT5 APIs
//
//----------------------------------------------------------------------------
//
// Default provider
//
#define ACCCTRL_DEFAULT_PROVIDER TEXT("Windows NT Access Provider")
//
/// Access rights
//
typedef ULONG ACCESS_RIGHTS, *PACCESS_RIGHTS;
//
// Inheritance flags
//
typedef ULONG INHERIT_FLAGS, *PINHERIT_FLAGS;
//
// Access / Audit structures
//
typedef struct _ACTRL_ACCESS_ENTRYA
{
TRUSTEE_A Trustee;
ULONG fAccessFlags;
ACCESS_RIGHTS Access;
ACCESS_RIGHTS ProvSpecificAccess;
INHERIT_FLAGS Inheritance;
LPSTR lpInheritProperty;
} ACTRL_ACCESS_ENTRYA, *PACTRL_ACCESS_ENTRYA;
//
// Access / Audit structures
//
typedef struct _ACTRL_ACCESS_ENTRYW
{
TRUSTEE_W Trustee;
ULONG fAccessFlags;
ACCESS_RIGHTS Access;
ACCESS_RIGHTS ProvSpecificAccess;
INHERIT_FLAGS Inheritance;
LPWSTR lpInheritProperty;
} ACTRL_ACCESS_ENTRYW, *PACTRL_ACCESS_ENTRYW;
#ifdef UNICODE
typedef ACTRL_ACCESS_ENTRYW ACTRL_ACCESS_ENTRY;
typedef PACTRL_ACCESS_ENTRYW PACTRL_ACCESS_ENTRY;
#else
typedef ACTRL_ACCESS_ENTRYA ACTRL_ACCESS_ENTRY;
typedef PACTRL_ACCESS_ENTRYA PACTRL_ACCESS_ENTRY;
#endif // UNICODE
typedef struct _ACTRL_ACCESS_ENTRY_LISTA
{
ULONG cEntries;
#ifdef __midl
[size_is(cEntries)]
#endif
ACTRL_ACCESS_ENTRYA *pAccessList;
} ACTRL_ACCESS_ENTRY_LISTA, *PACTRL_ACCESS_ENTRY_LISTA;
typedef struct _ACTRL_ACCESS_ENTRY_LISTW
{
ULONG cEntries;
#ifdef __midl
[size_is(cEntries)]
#endif
ACTRL_ACCESS_ENTRYW *pAccessList;
} ACTRL_ACCESS_ENTRY_LISTW, *PACTRL_ACCESS_ENTRY_LISTW;
#ifdef UNICODE
typedef ACTRL_ACCESS_ENTRY_LISTW ACTRL_ACCESS_ENTRY_LIST;
typedef PACTRL_ACCESS_ENTRY_LISTW PACTRL_ACCESS_ENTRY_LIST;
#else
typedef ACTRL_ACCESS_ENTRY_LISTA ACTRL_ACCESS_ENTRY_LIST;
typedef PACTRL_ACCESS_ENTRY_LISTA PACTRL_ACCESS_ENTRY_LIST;
#endif // UNICODE
typedef struct _ACTRL_PROPERTY_ENTRYA
{
LPSTR lpProperty;
PACTRL_ACCESS_ENTRY_LISTA pAccessEntryList;
ULONG fListFlags;
} ACTRL_PROPERTY_ENTRYA, *PACTRL_PROPERTY_ENTRYA;
typedef struct _ACTRL_PROPERTY_ENTRYW
{
LPWSTR lpProperty;
PACTRL_ACCESS_ENTRY_LISTW pAccessEntryList;
ULONG fListFlags;
} ACTRL_PROPERTY_ENTRYW, *PACTRL_PROPERTY_ENTRYW;
#ifdef UNICODE
typedef ACTRL_PROPERTY_ENTRYW ACTRL_PROPERTY_ENTRY;
typedef PACTRL_PROPERTY_ENTRYW PACTRL_PROPERTY_ENTRY;
#else
typedef ACTRL_PROPERTY_ENTRYA ACTRL_PROPERTY_ENTRY;
typedef PACTRL_PROPERTY_ENTRYA PACTRL_PROPERTY_ENTRY;
#endif // UNICODE
typedef struct _ACTRL_ALISTA
{
ULONG cEntries;
#ifdef __midl
[size_is(cEntries)]
#endif
PACTRL_PROPERTY_ENTRYA pPropertyAccessList;
} ACTRL_ACCESSA, *PACTRL_ACCESSA, ACTRL_AUDITA, *PACTRL_AUDITA;
typedef struct _ACTRL_ALISTW
{
ULONG cEntries;
#ifdef __midl
[size_is(cEntries)]
#endif
PACTRL_PROPERTY_ENTRYW pPropertyAccessList;
} ACTRL_ACCESSW, *PACTRL_ACCESSW, ACTRL_AUDITW, *PACTRL_AUDITW;
#ifdef UNICODE
typedef ACTRL_ACCESSW ACTRL_ACCESS;
typedef PACTRL_ACCESSW PACTRL_ACCESS;
typedef ACTRL_AUDITW ACTRL_AUDIT;
typedef PACTRL_AUDITW PACTRL_AUDIT;
#else
typedef ACTRL_ACCESSA ACTRL_ACCESS;
typedef PACTRL_ACCESSA PACTRL_ACCESS;
typedef ACTRL_AUDITA ACTRL_AUDIT;
typedef PACTRL_AUDITA PACTRL_AUDIT;
#endif // UNICODE
//
// TRUSTEE_ACCESS flags
//
#define TRUSTEE_ACCESS_ALLOWED 0x00000001L
#define TRUSTEE_ACCESS_READ 0x00000002L
#define TRUSTEE_ACCESS_WRITE 0x00000004L
#define TRUSTEE_ACCESS_EXPLICIT 0x00000001L
#define TRUSTEE_ACCESS_READ_WRITE (TRUSTEE_ACCESS_READ | \
TRUSTEE_ACCESS_WRITE)
#define TRUSTEE_ACCESS_ALL 0xFFFFFFFFL
typedef struct _TRUSTEE_ACCESSA
{
LPSTR lpProperty;
ACCESS_RIGHTS Access;
ULONG fAccessFlags;
ULONG fReturnedAccess;
} TRUSTEE_ACCESSA, *PTRUSTEE_ACCESSA;
typedef struct _TRUSTEE_ACCESSW
{
LPWSTR lpProperty;
ACCESS_RIGHTS Access;
ULONG fAccessFlags;
ULONG fReturnedAccess;
} TRUSTEE_ACCESSW, *PTRUSTEE_ACCESSW;
#ifdef UNICODE
typedef TRUSTEE_ACCESSW TRUSTEE_ACCESS;
typedef PTRUSTEE_ACCESSW PTRUSTEE_ACCESS;
#else
typedef TRUSTEE_ACCESSA TRUSTEE_ACCESS;
typedef PTRUSTEE_ACCESSA PTRUSTEE_ACCESS;
#endif // UNICODE
//
// Generic permission values
//
#define ACTRL_RESERVED 0x00000000
#define ACTRL_PERM_1 0x00000001
#define ACTRL_PERM_2 0x00000002
#define ACTRL_PERM_3 0x00000004
#define ACTRL_PERM_4 0x00000008
#define ACTRL_PERM_5 0x00000010
#define ACTRL_PERM_6 0x00000020
#define ACTRL_PERM_7 0x00000040
#define ACTRL_PERM_8 0x00000080
#define ACTRL_PERM_9 0x00000100
#define ACTRL_PERM_10 0x00000200
#define ACTRL_PERM_11 0x00000400
#define ACTRL_PERM_12 0x00000800
#define ACTRL_PERM_13 0x00001000
#define ACTRL_PERM_14 0x00002000
#define ACTRL_PERM_15 0x00004000
#define ACTRL_PERM_16 0x00008000
#define ACTRL_PERM_17 0x00010000
#define ACTRL_PERM_18 0x00020000
#define ACTRL_PERM_19 0x00040000
#define ACTRL_PERM_20 0x00080000
//
// Access permissions
//
#define ACTRL_ACCESS_ALLOWED 0x00000001
#define ACTRL_ACCESS_DENIED 0x00000002
#define ACTRL_AUDIT_SUCCESS 0x00000004
#define ACTRL_AUDIT_FAILURE 0x00000008
//
// Property list flags
//
#define ACTRL_ACCESS_PROTECTED 0x00000001
//
// Standard and object rights
//
#define ACTRL_SYSTEM_ACCESS 0x04000000
#define ACTRL_DELETE 0x08000000
#define ACTRL_READ_CONTROL 0x10000000
#define ACTRL_CHANGE_ACCESS 0x20000000
#define ACTRL_CHANGE_OWNER 0x40000000
#define ACTRL_SYNCHRONIZE 0x80000000
#define ACTRL_STD_RIGHTS_ALL 0xf8000000
#define ACTRL_DS_OPEN ACTRL_RESERVED
#define ACTRL_DS_CREATE_CHILD ACTRL_PERM_1
#define ACTRL_DS_DELETE_CHILD ACTRL_PERM_2
#define ACTRL_DS_LIST ACTRL_PERM_3
#define ACTRL_DS_SELF ACTRL_PERM_4
#define ACTRL_DS_READ_PROP ACTRL_PERM_5
#define ACTRL_DS_WRITE_PROP ACTRL_PERM_6
#define ACTRL_FILE_READ ACTRL_PERM_1
#define ACTRL_FILE_WRITE ACTRL_PERM_2
#define ACTRL_FILE_APPEND ACTRL_PERM_3
#define ACTRL_FILE_READ_PROP ACTRL_PERM_4
#define ACTRL_FILE_WRITE_PROP ACTRL_PERM_5
#define ACTRL_FILE_EXECUTE ACTRL_PERM_6
#define ACTRL_FILE_READ_ATTRIB ACTRL_PERM_7
#define ACTRL_FILE_WRITE_ATTRIB ACTRL_PERM_8
#define ACTRL_DIR_LIST ACTRL_PERM_1
#define ACTRL_DIR_CREATE_OBJECT ACTRL_PERM_2
#define ACTRL_DIR_CREATE_CHILD ACTRL_PERM_3
#define ACTRL_DIR_DELETE_CHILD ACTRL_PERM_4
#define ACTRL_DIR_TRAVERSE ACTRL_PERM_6
#define ACTRL_KERNEL_TERMINATE ACTRL_PERM_1
#define ACTRL_KERNEL_THREAD ACTRL_PERM_2
#define ACTRL_KERNEL_VM ACTRL_PERM_3
#define ACTRL_KERNEL_VM_READ ACTRL_PERM_4
#define ACTRL_KERNEL_VM_WRITE ACTRL_PERM_5
#define ACTRL_KERNEL_DUP_HANDLE ACTRL_PERM_6
#define ACTRL_KERNEL_PROCESS ACTRL_PERM_7
#define ACTRL_KERNEL_SET_INFO ACTRL_PERM_8
#define ACTRL_KERNEL_GET_INFO ACTRL_PERM_9
#define ACTRL_KERNEL_CONTROL ACTRL_PERM_10
#define ACTRL_KERNEL_ALERT ACTRL_PERM_11
#define ACTRL_KERNEL_GET_CONTEXT ACTRL_PERM_12
#define ACTRL_KERNEL_SET_CONTEXT ACTRL_PERM_13
#define ACTRL_KERNEL_TOKEN ACTRL_PERM_14
#define ACTRL_KERNEL_IMPERSONATE ACTRL_PERM_15
#define ACTRL_KERNEL_DIMPERSONATE ACTRL_PERM_16
#define ACTRL_PRINT_SADMIN ACTRL_PERM_1
#define ACTRL_PRINT_SLIST ACTRL_PERM_2
#define ACTRL_PRINT_PADMIN ACTRL_PERM_3
#define ACTRL_PRINT_PUSE ACTRL_PERM_4
#define ACTRL_PRINT_JADMIN ACTRL_PERM_5
#define ACTRL_SVC_GET_INFO ACTRL_PERM_1
#define ACTRL_SVC_SET_INFO ACTRL_PERM_2
#define ACTRL_SVC_STATUS ACTRL_PERM_3
#define ACTRL_SVC_LIST ACTRL_PERM_4
#define ACTRL_SVC_START ACTRL_PERM_5
#define ACTRL_SVC_STOP ACTRL_PERM_6
#define ACTRL_SVC_PAUSE ACTRL_PERM_7
#define ACTRL_SVC_INTERROGATE ACTRL_PERM_8
#define ACTRL_SVC_UCONTROL ACTRL_PERM_9
#define ACTRL_REG_QUERY ACTRL_PERM_1
#define ACTRL_REG_SET ACTRL_PERM_2
#define ACTRL_REG_CREATE_CHILD ACTRL_PERM_3
#define ACTRL_REG_LIST ACTRL_PERM_4
#define ACTRL_REG_NOTIFY ACTRL_PERM_5
#define ACTRL_REG_LINK ACTRL_PERM_6
#define ACTRL_WIN_CLIPBRD ACTRL_PERM_1
#define ACTRL_WIN_GLOBAL_ATOMS ACTRL_PERM_2
#define ACTRL_WIN_CREATE ACTRL_PERM_3
#define ACTRL_WIN_LIST_DESK ACTRL_PERM_4
#define ACTRL_WIN_LIST ACTRL_PERM_5
#define ACTRL_WIN_READ_ATTRIBS ACTRL_PERM_6
#define ACTRL_WIN_WRITE_ATTRIBS ACTRL_PERM_7
#define ACTRL_WIN_SCREEN ACTRL_PERM_8
#define ACTRL_WIN_EXIT ACTRL_PERM_9
typedef struct _ACTRL_OVERLAPPED
{
ULONG Reserved1;
ULONG Reserved2;
HANDLE hEvent;
} ACTRL_OVERLAPPED, *PACTRL_OVERLAPPED;
typedef struct _ACTRL_ACCESS_INFOA
{
ULONG fAccessPermission;
LPSTR lpAccessPermissionName;
} ACTRL_ACCESS_INFOA, *PACTRL_ACCESS_INFOA;
typedef struct _ACTRL_ACCESS_INFOW
{
ULONG fAccessPermission;
LPWSTR lpAccessPermissionName;
} ACTRL_ACCESS_INFOW, *PACTRL_ACCESS_INFOW;
#ifdef UNICODE
typedef ACTRL_ACCESS_INFOW ACTRL_ACCESS_INFO;
typedef PACTRL_ACCESS_INFOW PACTRL_ACCESS_INFO;
#else
typedef ACTRL_ACCESS_INFOA ACTRL_ACCESS_INFO;
typedef PACTRL_ACCESS_INFOA PACTRL_ACCESS_INFO;
#endif // UNICODE
typedef struct _ACTRL_CONTROL_INFOA
{
LPSTR lpControlId;
LPSTR lpControlName;
} ACTRL_CONTROL_INFOA, *PACTRL_CONTROL_INFOA;
typedef struct _ACTRL_CONTROL_INFOW
{
LPWSTR lpControlId;
LPWSTR lpControlName;
} ACTRL_CONTROL_INFOW, *PACTRL_CONTROL_INFOW;
#ifdef UNICODE
typedef ACTRL_CONTROL_INFOW ACTRL_CONTROL_INFO;
typedef PACTRL_CONTROL_INFOW PACTRL_CONTROL_INFO;
#else
typedef ACTRL_CONTROL_INFOA ACTRL_CONTROL_INFO;
typedef PACTRL_CONTROL_INFOA PACTRL_CONTROL_INFO;
#endif // UNICODE
#define ACTRL_ACCESS_NO_OPTIONS 0x00000000
#define ACTRL_ACCESS_SUPPORTS_OBJECT_ENTRIES 0x00000001
#ifdef __cplusplus
}
#endif
#endif // __ACCESS_CONTROL__
@@ -0,0 +1,715 @@
//+-------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1993-1997.
//
// File: aclapi.h
//
// Contents: public header file for acl and trusted server access control
// APIs
//
//--------------------------------------------------------------------
#ifndef __ACCESS_CONTROL_API__
#define __ACCESS_CONTROL_API__
#ifdef __cplusplus
extern "C" {
#endif
#include <windows.h>
#include <accctrl.h>
DWORD
WINAPI
SetEntriesInAclA( IN ULONG cCountOfExplicitEntries,
IN PEXPLICIT_ACCESS_A pListOfExplicitEntries,
IN PACL OldAcl,
OUT PACL * NewAcl);
DWORD
WINAPI
SetEntriesInAclW( IN ULONG cCountOfExplicitEntries,
IN PEXPLICIT_ACCESS_W pListOfExplicitEntries,
IN PACL OldAcl,
OUT PACL * NewAcl);
#ifdef UNICODE
#define SetEntriesInAcl SetEntriesInAclW
#else
#define SetEntriesInAcl SetEntriesInAclA
#endif // !UNICODE
DWORD
WINAPI
GetExplicitEntriesFromAclA( IN PACL pacl,
OUT PULONG pcCountOfExplicitEntries,
OUT PEXPLICIT_ACCESS_A * pListOfExplicitEntries);
DWORD
WINAPI
GetExplicitEntriesFromAclW( IN PACL pacl,
OUT PULONG pcCountOfExplicitEntries,
OUT PEXPLICIT_ACCESS_W * pListOfExplicitEntries);
#ifdef UNICODE
#define GetExplicitEntriesFromAcl GetExplicitEntriesFromAclW
#else
#define GetExplicitEntriesFromAcl GetExplicitEntriesFromAclA
#endif // !UNICODE
DWORD
WINAPI
GetEffectiveRightsFromAclA( IN PACL pacl,
IN PTRUSTEE_A pTrustee,
OUT PACCESS_MASK pAccessRights);
DWORD
WINAPI
GetEffectiveRightsFromAclW( IN PACL pacl,
IN PTRUSTEE_W pTrustee,
OUT PACCESS_MASK pAccessRights);
#ifdef UNICODE
#define GetEffectiveRightsFromAcl GetEffectiveRightsFromAclW
#else
#define GetEffectiveRightsFromAcl GetEffectiveRightsFromAclA
#endif // !UNICODE
DWORD
WINAPI
GetAuditedPermissionsFromAclA( IN PACL pacl,
IN PTRUSTEE_A pTrustee,
OUT PACCESS_MASK pSuccessfulAuditedRights,
OUT PACCESS_MASK pFailedAuditRights);
DWORD
WINAPI
GetAuditedPermissionsFromAclW( IN PACL pacl,
IN PTRUSTEE_W pTrustee,
OUT PACCESS_MASK pSuccessfulAuditedRights,
OUT PACCESS_MASK pFailedAuditRights);
#ifdef UNICODE
#define GetAuditedPermissionsFromAcl GetAuditedPermissionsFromAclW
#else
#define GetAuditedPermissionsFromAcl GetAuditedPermissionsFromAclA
#endif // !UNICODE
DWORD
WINAPI
GetNamedSecurityInfoA( IN LPSTR pObjectName,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
OUT PSID * ppsidOowner,
OUT PSID * ppsidGroup,
OUT PACL * ppDacl,
OUT PACL * ppSacl,
OUT PSECURITY_DESCRIPTOR * ppSecurityDescriptor);
DWORD
WINAPI
GetNamedSecurityInfoW( IN LPWSTR pObjectName,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
OUT PSID * ppsidOowner,
OUT PSID * ppsidGroup,
OUT PACL * ppDacl,
OUT PACL * ppSacl,
OUT PSECURITY_DESCRIPTOR * ppSecurityDescriptor);
#ifdef UNICODE
#define GetNamedSecurityInfo GetNamedSecurityInfoW
#else
#define GetNamedSecurityInfo GetNamedSecurityInfoA
#endif // !UNICODE
DWORD
WINAPI
GetSecurityInfo( IN HANDLE handle,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
OUT PSID * ppsidOowner,
OUT PSID * ppsidGroup,
OUT PACL * ppDacl,
OUT PACL * ppSacl,
OUT PSECURITY_DESCRIPTOR * ppSecurityDescriptor);
DWORD
WINAPI
SetNamedSecurityInfoA( IN LPSTR pObjectName,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN PSID psidOowner,
IN PSID psidGroup,
IN PACL pDacl,
IN PACL pSacl);
DWORD
WINAPI
SetNamedSecurityInfoW( IN LPWSTR pObjectName,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN PSID psidOowner,
IN PSID psidGroup,
IN PACL pDacl,
IN PACL pSacl);
#ifdef UNICODE
#define SetNamedSecurityInfo SetNamedSecurityInfoW
#else
#define SetNamedSecurityInfo SetNamedSecurityInfoA
#endif // !UNICODE
DWORD
WINAPI
SetSecurityInfo( IN HANDLE handle,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN PSID psidOowner,
IN PSID psidGroup,
IN PACL pDacl,
IN PACL pSacl);
//----------------------------------------------------------------------------
// The following API are provided for trusted servers to use to
// implement access control on their own objects.
//----------------------------------------------------------------------------
DWORD
WINAPI
BuildSecurityDescriptorA( IN PTRUSTEE_A pOwner,
IN PTRUSTEE_A pGroup,
IN ULONG cCountOfAccessEntries,
IN PEXPLICIT_ACCESS_A pListOfAccessEntries,
IN ULONG cCountOfAuditEntries,
IN PEXPLICIT_ACCESS_A pListOfAuditEntries,
IN PSECURITY_DESCRIPTOR pOldSD,
OUT PULONG pSizeNewSD,
OUT PSECURITY_DESCRIPTOR * pNewSD);
DWORD
WINAPI
BuildSecurityDescriptorW( IN PTRUSTEE_W pOwner,
IN PTRUSTEE_W pGroup,
IN ULONG cCountOfAccessEntries,
IN PEXPLICIT_ACCESS_W pListOfAccessEntries,
IN ULONG cCountOfAuditEntries,
IN PEXPLICIT_ACCESS_W pListOfAuditEntries,
IN PSECURITY_DESCRIPTOR pOldSD,
OUT PULONG pSizeNewSD,
OUT PSECURITY_DESCRIPTOR * pNewSD);
#ifdef UNICODE
#define BuildSecurityDescriptor BuildSecurityDescriptorW
#else
#define BuildSecurityDescriptor BuildSecurityDescriptorA
#endif // !UNICODE
DWORD
WINAPI
LookupSecurityDescriptorPartsA( OUT PTRUSTEE_A * pOwner,
OUT PTRUSTEE_A * pGroup,
OUT PULONG cCountOfAccessEntries,
OUT PEXPLICIT_ACCESS_A * pListOfAccessEntries,
OUT PULONG cCountOfAuditEntries,
OUT PEXPLICIT_ACCESS_A * pListOfAuditEntries,
IN PSECURITY_DESCRIPTOR pSD);
DWORD
WINAPI
LookupSecurityDescriptorPartsW( OUT PTRUSTEE_W * pOwner,
OUT PTRUSTEE_W * pGroup,
OUT PULONG cCountOfAccessEntries,
OUT PEXPLICIT_ACCESS_W * pListOfAccessEntries,
OUT PULONG cCountOfAuditEntries,
OUT PEXPLICIT_ACCESS_W * pListOfAuditEntries,
IN PSECURITY_DESCRIPTOR pSD);
#ifdef UNICODE
#define LookupSecurityDescriptorParts LookupSecurityDescriptorPartsW
#else
#define LookupSecurityDescriptorParts LookupSecurityDescriptorPartsA
#endif // !UNICODE
//----------------------------------------------------------------------------
// The following helper API are provided for building
// access control structures.
//----------------------------------------------------------------------------
VOID
WINAPI
BuildExplicitAccessWithNameA( IN OUT PEXPLICIT_ACCESS_A pExplicitAccess,
IN LPSTR pTrusteeName,
IN DWORD AccessPermissions,
IN ACCESS_MODE AccessMode,
IN DWORD Inheritance);
VOID
WINAPI
BuildExplicitAccessWithNameW( IN OUT PEXPLICIT_ACCESS_W pExplicitAccess,
IN LPWSTR pTrusteeName,
IN DWORD AccessPermissions,
IN ACCESS_MODE AccessMode,
IN DWORD Inheritance);
#ifdef UNICODE
#define BuildExplicitAccessWithName BuildExplicitAccessWithNameW
#else
#define BuildExplicitAccessWithName BuildExplicitAccessWithNameA
#endif // !UNICODE
VOID
WINAPI
BuildImpersonateExplicitAccessWithNameA(
IN OUT PEXPLICIT_ACCESS_A pExplicitAccess,
IN LPSTR pTrusteeName,
IN PTRUSTEE_A pTrustee,
IN DWORD AccessPermissions,
IN ACCESS_MODE AccessMode,
IN DWORD Inheritance);
VOID
WINAPI
BuildImpersonateExplicitAccessWithNameW(
IN OUT PEXPLICIT_ACCESS_W pExplicitAccess,
IN LPWSTR pTrusteeName,
IN PTRUSTEE_W pTrustee,
IN DWORD AccessPermissions,
IN ACCESS_MODE AccessMode,
IN DWORD Inheritance);
#ifdef UNICODE
#define BuildImpersonateExplicitAccessWithName BuildImpersonateExplicitAccessWithNameW
#else
#define BuildImpersonateExplicitAccessWithName BuildImpersonateExplicitAccessWithNameA
#endif // !UNICODE
VOID
WINAPI
BuildTrusteeWithNameA( IN OUT PTRUSTEE_A pTrustee,
IN LPSTR pName);
VOID
WINAPI
BuildTrusteeWithNameW( IN OUT PTRUSTEE_W pTrustee,
IN LPWSTR pName);
#ifdef UNICODE
#define BuildTrusteeWithName BuildTrusteeWithNameW
#else
#define BuildTrusteeWithName BuildTrusteeWithNameA
#endif // !UNICODE
VOID
WINAPI
BuildImpersonateTrusteeA( IN OUT PTRUSTEE_A pTrustee,
IN PTRUSTEE_A pImpersonateTrustee);
VOID
WINAPI
BuildImpersonateTrusteeW( IN OUT PTRUSTEE_W pTrustee,
IN PTRUSTEE_W pImpersonateTrustee);
#ifdef UNICODE
#define BuildImpersonateTrustee BuildImpersonateTrusteeW
#else
#define BuildImpersonateTrustee BuildImpersonateTrusteeA
#endif // !UNICODE
VOID
WINAPI
BuildTrusteeWithSidA( IN OUT PTRUSTEE_A pTrustee,
IN PSID pSid);
VOID
WINAPI
BuildTrusteeWithSidW( IN OUT PTRUSTEE_W pTrustee,
IN PSID pSid);
#ifdef UNICODE
#define BuildTrusteeWithSid BuildTrusteeWithSidW
#else
#define BuildTrusteeWithSid BuildTrusteeWithSidA
#endif // !UNICODE
LPSTR
WINAPI
GetTrusteeNameA( IN PTRUSTEE_A pTrustee);
LPWSTR
WINAPI
GetTrusteeNameW( IN PTRUSTEE_W pTrustee);
#ifdef UNICODE
#define GetTrusteeName GetTrusteeNameW
#else
#define GetTrusteeName GetTrusteeNameA
#endif // !UNICODE
TRUSTEE_TYPE
WINAPI
GetTrusteeTypeA( IN PTRUSTEE_A pTrustee);
TRUSTEE_TYPE
WINAPI
GetTrusteeTypeW( IN PTRUSTEE_W pTrustee);
#ifdef UNICODE
#define GetTrusteeType GetTrusteeTypeW
#else
#define GetTrusteeType GetTrusteeTypeA
#endif // !UNICODE
TRUSTEE_FORM
WINAPI
GetTrusteeFormA( IN PTRUSTEE_A pTrustee);
TRUSTEE_FORM
WINAPI
GetTrusteeFormW( IN PTRUSTEE_W pTrustee);
#ifdef UNICODE
#define GetTrusteeForm GetTrusteeFormW
#else
#define GetTrusteeForm GetTrusteeFormA
#endif // !UNICODE
MULTIPLE_TRUSTEE_OPERATION
WINAPI
GetMultipleTrusteeOperationA( IN PTRUSTEE_A pTrustee);
MULTIPLE_TRUSTEE_OPERATION
WINAPI
GetMultipleTrusteeOperationW( IN PTRUSTEE_W pTrustee);
#ifdef UNICODE
#define GetMultipleTrusteeOperation GetMultipleTrusteeOperationW
#else
#define GetMultipleTrusteeOperation GetMultipleTrusteeOperationA
#endif // !UNICODE
PTRUSTEE_A
WINAPI
GetMultipleTrusteeA( IN PTRUSTEE_A pTrustee);
PTRUSTEE_W
WINAPI
GetMultipleTrusteeW( IN PTRUSTEE_W pTrustee);
#ifdef UNICODE
#define GetMultipleTrustee GetMultipleTrusteeW
#else
#define GetMultipleTrustee GetMultipleTrusteeA
#endif // !UNICODE
#if(_WIN32_WINNT >= 0x0500)
//----------------------------------------------------------------------------
//
// NT5 APIs
//
//----------------------------------------------------------------------------
DWORD
WINAPI
GetNamedSecurityInfoExA(IN LPCSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN LPCSTR lpProvider,
IN LPCSTR lpProperty,
OUT PACTRL_ACCESSA *ppAccessList,
OUT PACTRL_AUDITA *ppAuditList,
OUT LPSTR *lppOwner,
OUT LPSTR *lppGroup);
DWORD
WINAPI
GetNamedSecurityInfoExW(IN LPCWSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN LPCWSTR lpProvider,
IN LPCWSTR lpProperty,
OUT PACTRL_ACCESSW *ppAccessList,
OUT PACTRL_AUDITW *ppAuditList,
OUT LPWSTR *lppOwner,
OUT LPWSTR *lppGroup);
#ifdef UNICODE
#define GetNamedSecurityInfoEx GetNamedSecurityInfoExW
#else
#define GetNamedSecurityInfoEx GetNamedSecurityInfoExA
#endif // !UNICODE
DWORD
WINAPI
SetNamedSecurityInfoExA(IN LPCSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN LPCSTR lpProvider,
IN PACTRL_ACCESSA pAccessList,
IN PACTRL_AUDITA pAuditList,
IN LPSTR lpOwner,
IN LPSTR lpGroup,
IN PACTRL_OVERLAPPED pOverlapped);
DWORD
WINAPI
SetNamedSecurityInfoExW(IN LPCWSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN LPCWSTR lpProvider,
IN PACTRL_ACCESSW pAccessList,
IN PACTRL_AUDITW pAuditList,
IN LPWSTR lpOwner,
IN LPWSTR lpGroup,
IN PACTRL_OVERLAPPED pOverlapped);
#ifdef UNICODE
#define SetNamedSecurityInfoEx SetNamedSecurityInfoExW
#else
#define SetNamedSecurityInfoEx SetNamedSecurityInfoExA
#endif // !UNICODE
DWORD
WINAPI
GetSecurityInfoExA(IN HANDLE hObject,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN LPCSTR lpProvider,
IN LPCSTR lpProperty,
OUT PACTRL_ACCESSA *ppAccessList,
OUT PACTRL_AUDITA *ppAuditList,
OUT LPSTR *lppOwner,
OUT LPSTR *lppGroup);
DWORD
WINAPI
GetSecurityInfoExW(IN HANDLE hObject,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN LPCWSTR lpProvider,
IN LPCWSTR lpProperty,
OUT PACTRL_ACCESSW *ppAccessList,
OUT PACTRL_AUDITW *ppAuditList,
OUT LPWSTR *lppOwner,
OUT LPWSTR *lppGroup);
#ifdef UNICODE
#define GetSecurityInfoEx GetSecurityInfoExW
#else
#define GetSecurityInfoEx GetSecurityInfoExA
#endif // !UNICODE
DWORD
WINAPI
SetSecurityInfoExA(IN HANDLE hObject,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN LPCSTR lpProvider,
IN PACTRL_ACCESSA pAccessList,
IN PACTRL_AUDITA pAuditList,
IN LPSTR lpOwner,
IN LPSTR lpGroup,
OUT PACTRL_OVERLAPPED pOverlapped);
DWORD
WINAPI
SetSecurityInfoExW(IN HANDLE hObject,
IN SE_OBJECT_TYPE ObjectType,
IN SECURITY_INFORMATION SecurityInfo,
IN LPCWSTR lpProvider,
IN PACTRL_ACCESSW pAccessList,
IN PACTRL_AUDITW pAuditList,
IN LPWSTR lpOwner,
IN LPWSTR lpGroup,
OUT PACTRL_OVERLAPPED pOverlapped);
#ifdef UNICODE
#define SetSecurityInfoEx SetSecurityInfoExW
#else
#define SetSecurityInfoEx SetSecurityInfoExA
#endif // !UNICODE
DWORD
WINAPI
ConvertAccessToSecurityDescriptorA(IN PACTRL_ACCESSA pAccessList,
IN PACTRL_AUDITA pAuditList,
IN LPCSTR lpOwner,
IN LPCSTR lpGroup,
OUT PSECURITY_DESCRIPTOR *ppSecDescriptor);
DWORD
WINAPI
ConvertAccessToSecurityDescriptorW(IN PACTRL_ACCESSW pAccessList,
IN PACTRL_AUDITW pAuditList,
IN LPCWSTR lpOwner,
IN LPCWSTR lpGroup,
OUT PSECURITY_DESCRIPTOR *ppSecDescriptor);
#ifdef UNICODE
#define ConvertAccessToSecurityDescriptor ConvertAccessToSecurityDescriptorW
#else
#define ConvertAccessToSecurityDescriptor ConvertAccessToSecurityDescriptorA
#endif // !UNICODE
DWORD
WINAPI
ConvertSecurityDescriptorToAccessA(IN HANDLE hObject,
IN SE_OBJECT_TYPE ObjectType,
IN PSECURITY_DESCRIPTOR pSecDescriptor,
OUT PACTRL_ACCESSA *ppAccessList,
OUT PACTRL_AUDITA *ppAuditList,
OUT LPSTR *lppOwner,
OUT LPSTR *lppGroup);
DWORD
WINAPI
ConvertSecurityDescriptorToAccessW(IN HANDLE hObject,
IN SE_OBJECT_TYPE ObjectType,
IN PSECURITY_DESCRIPTOR pSecDescriptor,
OUT PACTRL_ACCESSW *ppAccessList,
OUT PACTRL_AUDITW *ppAuditList,
OUT LPWSTR *lppOwner,
OUT LPWSTR *lppGroup);
#ifdef UNICODE
#define ConvertSecurityDescriptorToAccess ConvertSecurityDescriptorToAccessW
#else
#define ConvertSecurityDescriptorToAccess ConvertSecurityDescriptorToAccessA
#endif // !UNICODE
DWORD
WINAPI
ConvertSecurityDescriptorToAccessNamedA(IN LPCSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN PSECURITY_DESCRIPTOR pSecDescriptor,
OUT PACTRL_ACCESSA *ppAccessList,
OUT PACTRL_AUDITA *ppAuditList,
OUT LPSTR *lppOwner,
OUT LPSTR *lppGroup);
DWORD
WINAPI
ConvertSecurityDescriptorToAccessNamedW(IN LPCWSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN PSECURITY_DESCRIPTOR pSecDescriptor,
OUT PACTRL_ACCESSW *ppAccessList,
OUT PACTRL_AUDITW *ppAuditList,
OUT LPWSTR *lppOwner,
OUT LPWSTR *lppGroup);
#ifdef UNICODE
#define ConvertSecurityDescriptorToAccessNamed ConvertSecurityDescriptorToAccessNamedW
#else
#define ConvertSecurityDescriptorToAccessNamed ConvertSecurityDescriptorToAccessNamedA
#endif // !UNICODE
DWORD
WINAPI
SetEntriesInAccessListA(IN ULONG cEntries,
IN PACTRL_ACCESS_ENTRYA pAccessEntryList,
IN ACCESS_MODE AccessMode,
IN LPCSTR lpProperty,
IN PACTRL_ACCESSA pOldList,
OUT PACTRL_ACCESSA *ppNewList);
DWORD
WINAPI
SetEntriesInAccessListW(IN ULONG cEntries,
IN PACTRL_ACCESS_ENTRYW pAccessEntryList,
IN ACCESS_MODE AccessMode,
IN LPCWSTR lpProperty,
IN PACTRL_ACCESSW pOldList,
OUT PACTRL_ACCESSW *ppNewList);
#ifdef UNICODE
#define SetEntriesInAccessList SetEntriesInAccessListW
#else
#define SetEntriesInAccessList SetEntriesInAccessListA
#endif // !UNICODE
DWORD
WINAPI
SetEntriesInAuditListA(IN ULONG cEntries,
IN PACTRL_ACCESS_ENTRYA pAccessEntryList,
IN ACCESS_MODE AccessMode,
IN LPCSTR lpProperty,
IN PACTRL_AUDITA pOldList,
OUT PACTRL_AUDITA *ppNewList);
DWORD
WINAPI
SetEntriesInAuditListW(IN ULONG cEntries,
IN PACTRL_ACCESS_ENTRYW pAccessEntryList,
IN ACCESS_MODE AccessMode,
IN LPCWSTR lpProperty,
IN PACTRL_AUDITW pOldList,
OUT PACTRL_AUDITW *ppNewList);
#ifdef UNICODE
#define SetEntriesInAuditList SetEntriesInAuditListW
#else
#define SetEntriesInAuditList SetEntriesInAuditListA
#endif // !UNICODE
DWORD
WINAPI
TrusteeAccessToObjectA(IN LPCSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN LPCSTR lpProvider,
IN PTRUSTEE_A pTrustee,
IN ULONG cEntries,
IN OUT PTRUSTEE_ACCESSA pTrusteeAccess);
DWORD
WINAPI
TrusteeAccessToObjectW(IN LPCWSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN LPCWSTR lpProvider,
IN PTRUSTEE_W pTrustee,
IN ULONG cEntries,
IN OUT PTRUSTEE_ACCESSW pTrusteeAccess);
#ifdef UNICODE
#define TrusteeAccessToObject TrusteeAccessToObjectW
#else
#define TrusteeAccessToObject TrusteeAccessToObjectA
#endif // !UNICODE
DWORD
WINAPI
GetOverlappedAccessResults( IN PACTRL_OVERLAPPED pOverlapped,
IN BOOL fWaitForCompletion,
OUT PDWORD pResult,
OUT PULONG pcItemsProcessed OPTIONAL);
DWORD
WINAPI
CancelOverlappedAccess(IN PACTRL_OVERLAPPED pOverlapped);
DWORD
WINAPI
GetAccessPermissionsForObjectA(IN LPCSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN LPCSTR lpObjType,
IN LPCSTR lpProvider,
OUT PULONG pcEntries,
OUT PACTRL_ACCESS_INFOA *ppAccessInfoList,
OUT PULONG pcRights,
OUT PACTRL_CONTROL_INFOA *ppRightsList,
OUT PULONG pfAccessFlags);
DWORD
WINAPI
GetAccessPermissionsForObjectW(IN LPCWSTR lpObject,
IN SE_OBJECT_TYPE ObjectType,
IN LPCWSTR lpObjType,
IN LPCWSTR lpProvider,
OUT PULONG pcEntries,
OUT PACTRL_ACCESS_INFOW *ppAccessInfoList,
OUT PULONG pcRights,
OUT PACTRL_CONTROL_INFOW *ppRightsList,
OUT PULONG pfAccessFlags);
#ifdef UNICODE
#define GetAccessPermissionsForObject GetAccessPermissionsForObjectW
#else
#define GetAccessPermissionsForObject GetAccessPermissionsForObjectA
#endif // !UNICODE
//
// Temporary requirement for the technology preview, no longer required
//
#define AccProvInit(err)
#endif /* _WIN32_WINNT >= 0x0500 */
#ifdef __cplusplus
}
#endif
#endif // __ACCESS_CONTROL_API__
@@ -0,0 +1,143 @@
// --aclcls.h------------------------------------------------------------------
//
// Interface to library: aclcls.
//
// Copyright 1986 - 1998 Microsoft Corporation. All rights reserved.
//
// ----------------------------------------------------------------------------
#if !defined(_ACLCLS_H_)
#define _ACLCLS_H_
// $$--IExchangeFolderACLs-----------------------------------------------------
//
// Definition of interface for folder ACLs class CFolderACLs.
//
// ----------------------------------------------------------------------------
#undef INTERFACE
#define INTERFACE IExchangeFolderACLs
// Manifest for cursor position indicating we are at the end of the ACLs table.
#define ACL_PAST_END ((LONG) -1)
// Special ACL positions. The special ACL's at these position may not be
// deleted, and there are also special rules (coming from Exchange) with
// regard to how rights will be modified. Also, other ACL's may not be inserted
// at these positions.
#define ACL_POS_DEFAULT ((LONG) 0)
#define ACL_POS_CREATOR ((LONG) 1)
DECLARE_INTERFACE_(IExchangeFolderACLs, IUnknown)
{
#ifndef NO_BASEINTERFACE_FUNCS
/* IUnknown methods */
STDMETHOD(QueryInterface)(
THIS_
REFIID riid,
LPVOID FAR * ppvObj
) PURE;
STDMETHOD_(ULONG, AddRef)(
THIS
) PURE;
STDMETHOD_(ULONG, Release)(
THIS
) PURE;
#endif
/* IExchangeFolderACLs methods */
STDMETHOD(HrDelete)(
THIS
) PURE;
STDMETHOD(HrGet)(
THIS_
LPLONG lplRights,
LPSTR FAR * lppszDisplayName,
ULONG FAR * lpcbentryid,
LPENTRYID FAR * lppentryid
) PURE;
STDMETHOD(HrInsert)(
THIS_
LONG lRights,
LPSTR lpszDisplayName,
ULONG cbentryid,
LPENTRYID lpentryid,
LPLONG lplRights
) PURE;
STDMETHOD(HrModify)(
THIS_
LONG lRights,
LPLONG lplRights
) PURE;
STDMETHOD(HrSeek)(
THIS_
LONG lPos
) PURE;
STDMETHOD(HrTell)(
THIS_
LPLONG lplPos
) PURE;
};
// $$--LPFOLDERACLS------------------------------------------------------------
//
// Pointer to IExchangeFolderACLs interface.
//
// ----------------------------------------------------------------------------
typedef IExchangeFolderACLs FAR * LPFOLDERACLS;
//
// Helper functions defined in module ACLCLS.
//
// $--HrFolderACLsOpen---------------------------------------------------------
//
// DESCRIPTION: Get a pointer to an object which implements the
// IExchangeFolderACLs interface defined in aclcls.h.
//
// INPUT:
//
// [lpSession] -- Pointer to MAPI session.
// [lpMDB] -- Pointer to message store containing folder.
// [cbentryid] -- Number of bytes in folder's entry identifier.
// [lpentryid] -- Folder's entry identifier.
//
// OUTPUT:
//
// [lppFolderACLs] -- Pointer to object which supports interface.
// NULL if none.
//
// RETURNS: NOERROR if successful;
// E_INVALIDARG if bad input;
// E_OUTOFMEMORY if not enough memory;
// E_NOINTERFACE if acl table does not exist on folder;
// E_FAIL otherwise.
//
//-----------------------------------------------------------------------------
STDAPI
HrFolderACLsOpen( // RETURNS: HRESULT
IN LPMAPISESSION lpSession, // MAPI session pointer
IN LPMDB lpMDB, // MAPI MDB store ptr
IN ULONG cbentryid, // # bytes in entry ID
IN LPENTRYID lpentryid, // entry ID ptr
OUT LPFOLDERACLS FAR * lppFolderACLs // IExchangeFolderACLs ptr ptr
);
#endif
@@ -0,0 +1,24 @@
// --aclsid.h------------------------------------------------------------------
//
// Defines the identifiers for the ACLs Class.
//
// Identifiers defined:
//
// LIBID_aclcls
//
// IID_IExchangeFolderACLs
//
// Copyright 1986 - 1998 Microsoft Corporation. All rights reserved.
//
// ----------------------------------------------------------------------------
#if !defined(_ACLSID_H_)
#define _ACLSID_H_
// Identifiers for the ExchangeFolderACLs foundation class.
DEFINE_GUID(LIBID_aclcls, 0xad2495a3, 0xa76c, 0x11ce, 0xb9, 0x67, 0x0, 0x20, 0xaf, 0x52, 0x52, 0x44);
DEFINE_GUID(IID_IExchangeFolderACLs, 0xad2495a6, 0xa76c, 0x11ce, 0xb9, 0x67, 0x0, 0x20, 0xaf, 0x52, 0x52, 0x44);
#endif
@@ -0,0 +1,7 @@
/*****************************************************************************/
/* Now a stub file to allow back compatibility, real file is winmgt.h */
/*****************************************************************************/
#include <winmgt.h>

@@ -0,0 +1,6 @@
/*****************************************************************************/
/* Now a stub file to allow back compatibility, real file now wincsv.h */
/*****************************************************************************/
#include <wincsv.h>

@@ -0,0 +1,23 @@
//==========================================================================;
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1992 - 1997 Microsoft Corporation. All Rights Reserved.
//
//--------------------------------------------------------------------------;
//
// Contains the data formats for the transfer of VfW4 filters
// via the clipboard
#define CFSTR_VFW_FILTERLIST "Video for Windows 4 Filters"
typedef struct tagVFW_FILTERLIST{
UINT cFilters; // number of CLSIDs in aClsId
CLSID aClsId[1]; // ClsId of each filter
} VFW_FILTERLIST;
@@ -0,0 +1,58 @@
//+---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1996
//
// File: ads.h
//
// Contents: Master include file for Ole Ds
//
// Notes: All Ole Ds client applications must include this file. This
// provides access to the primary Ole Ds interfaces, the error
// codes, and function prototypes for the Ole Ds helper apis.
//
//----------------------------------------------------------------------------
//
// Interface definitions and well known GUIDS for Ole Ds
//
#include "iads.h"
//
// Helper function prototypes for Ole Ds
//
#include "adshlp.h"
//
// Error codes for Ole Ds - generated from ..\..\errmsg
//
#include "adserr.h"
//
// Globally accessible GUIDS
//
#include "adsiid.h"
//
// Status codes for ads objects
//
#include "adssts.h"
//
// Schema class names and other schema related definitions
//
#include "adsnms.h"
//
// Definitions in the OLE DB provider for ADSI
//
#include "adsdb.h"
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,150 @@
// ==========================================================================
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (c) 1992 - 1997 Microsoft Corporation. All Rights Reserved.
//
// --------------------------------------------------------------------------
//
// ACTIVEX.RCV
//
// Description:
// This file defines the version resource used for the application.
//
// NOTE: All strings MUST have an explicit \0 for termination!
//
// For a complete description of the Version Resource, search the
// Microsoft Developer's Network (MSDN) CD-ROM for 'version resource'.
//
// ==========================================================================
#ifndef _ACTIVEX_RCV_
#define _ACTIVEX_RCV_
#ifdef WIN32
#include <winver.h>
#else
#include <ver.h>
#endif
#ifndef _ACTIVEX_VER_
#include <activex.ver>
#endif
//
// Version flags.
//
// OFFICIAL and FINAL should be defined when appropriate.
//
#ifndef OFFICIAL
#define VER_PRIVATEBUILD VS_FF_PRIVATEBUILD
#else
#define VER_PRIVATEBUILD 0
#endif
#ifndef FINAL
#define VER_PRERELEASE VS_FF_PRERELEASE
#else
#define VER_PRERELEASE 0
#endif
#ifdef DEBUG
#define VER_DEBUG VS_FF_DEBUG
#else
#define VER_DEBUG 0
#endif
//
// Version definitions
//
#define VERSION_RES_FLAGSMASK 0x0030003FL
#define VERSION_RES_FLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
#ifdef WIN32
#define VERSION_RES_OS VOS_NT_WINDOWS32
#else
#define VERSION_RES_OS VOS_DOS_WINDOWS16
#endif
#ifndef VERSION_RES_TYPE
#define VERSION_RES_TYPE VFT_DLL
#endif
#ifndef VERSION_RES_SUBTYPE
#define VERSION_RES_SUBTYPE VFT2_UNKNOWN
#endif
#define VERSION_RES_LANGUAGE 0x409
#ifdef UNICODE
#define VERSION_RES_CHARSET 1200
#else
#define VERSION_RES_CHARSET 1252
#endif
#ifndef VERSION_RES_ACTIVEX
#define VERSION_RES_ACTIVEX "Filter dll\0"
#endif
#ifdef AMOVIE_SELF_REGISTER
#ifndef OLE_SELF_REGISTER
#define OLE_SELF_REGISTER
#endif
#endif
#ifdef OLE_SELF_REGISTER
#ifdef AMOVIE_SELF_REGISTER
#define VERSION_RES_SELFREGISTER "AM20\0"
#else
#define VERSION_RES_SELFREGISTER "\0"
#endif
#endif
//
// Version resource
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_RES_MAJOR_VER, VERSION_RES_MINOR_VER, 0, VERSION_RES_BUILD
PRODUCTVERSION VERSION_RES_MAJOR_VER, VERSION_RES_MINOR_VER, 0, VERSION_RES_BUILD
FILEFLAGSMASK VERSION_RES_FLAGSMASK
FILEFLAGS VERSION_RES_FLAGS
FILEOS VERSION_RES_OS
FILETYPE VERSION_RES_TYPE
FILESUBTYPE VERSION_RES_SUBTYPE
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", VERSION_RES_COMPANY_NAME
VALUE "FileDescription", VERSION_RES_BIN_DESCRIPTION
VALUE "FileVersion", VERSION_RES_STRING
VALUE "InternalName", VERSION_RES_BIN_NAME
VALUE "LegalCopyright", VERSION_RES_COPYRIGHT
VALUE "OriginalFilename", VERSION_RES_BIN_NAME
VALUE "ProductName", VERSION_RES_PRODUCT_NAME
#ifdef DEBUG
VALUE "ProductVersion", VERSION_RES_STRING_D
#else
VALUE "ProductVersion", VERSION_RES_STRING
#endif
VALUE "ActiveMovie", VERSION_RES_ACTIVEX
#ifdef OLE_SELF_REGISTER
VALUE "OLESelfRegister", VERSION_RES_SELFREGISTER
#endif
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", VERSION_RES_LANGUAGE, VERSION_RES_CHARSET
END
END
#endif
// _ACTIVEX_RCV_

Some files were not shown because too many files have changed in this diff Show More