This commit is contained in:
2024-08-07 09:16:27 -04:00
parent fdfadd5c7e
commit 5f971cf684
5200 changed files with 731717 additions and 0 deletions

57
test/ABORTDLG.HPP Normal file
View File

@@ -0,0 +1,57 @@
#ifndef _TEST_ABORTDLG_HPP_
#define _TEST_ABORTDLG_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _DIALOG_DYNAMICDIALOG_HPP_
#include <dialog/dyndlg.hpp>
#endif
class AbortDlg : private DynamicDialog
{
public:
AbortDlg(void);
virtual ~AbortDlg();
void perform(GUIWindow &parentWindow);
BOOL isDestroyed(void)const;
BOOL isCancelled(void)const;
void destroy(void);
void yieldTask(void);
protected:
virtual void init(void);
private:
AbortDlg(const AbortDlg &AbortDlg);
AbortDlg &operator=(const AbortDlg &AbortDlg);
void create(GUIWindow &parentWindow);
WORD dlgCommand(DWORD commandID,CallbackData &someCallbackData);
BOOL dlgInitDialog(CallbackData &someCallbackData);
void dlgDestroyDialog(CallbackData &someCallbackData);
BOOL mIsDestroyed;
BOOL mIsCancelled;
};
inline
BOOL AbortDlg::isDestroyed(void)const
{
return mIsDestroyed;
}
inline
BOOL AbortDlg::isCancelled(void)const
{
return mIsCancelled;
}
inline
void AbortDlg::destroy(void)
{
GUIWindow::destroy();
}
inline
void AbortDlg::yieldTask(void)
{
GUIWindow::yieldTask();
}
#endif

109
test/ATOM.HPP Normal file
View File

@@ -0,0 +1,109 @@
#ifndef _TEST_ATOM_HPP_
#define _TEST_ATOM_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class Atom
{
public:
Atom(void);
virtual ~Atom();
BOOL operator==(const Atom &someAtom)const;
BOOL create(const String &strAtomName);
BOOL assume(const String &strAtomName);
BOOL getName(String &strAtomName)const;
BOOL isOkay(void)const;
void destroy(void);
private:
enum Disposition{Assume,Destroy,None};
enum {MaxString=256};
Atom(const Atom &someAtom);
Atom &operator=(const Atom &someAtom);
Disposition disposition(void)const;
void disposition(Disposition disposition);
ATOM mhAtom;
Disposition mDisposition;
};
inline
Atom::Atom(void)
: mhAtom(0), mDisposition(None)
{
}
inline
Atom::Atom(const Atom &someAtom)
{ // private implementation
*this=someAtom;
}
inline
Atom::~Atom()
{
destroy();
}
inline
Atom &Atom::operator=(const Atom &someAtom)
{ // private implementation
return *this;
}
inline
BOOL Atom::operator==(const Atom &someAtom)const
{
return mhAtom==someAtom.mhAtom;
}
inline
BOOL Atom::create(const String &strAtomName)
{
destroy();
mhAtom=::GlobalAddAtom((LPSTR)(String&)strAtomName);
mDisposition=Destroy;
return isOkay();
}
inline
BOOL Atom::assume(const String &strAtomName)
{
destroy();
if(strAtomName.isNull())return FALSE;
mhAtom=::GlobalFindAtom((LPSTR)(String&)strAtomName);
if(!isOkay())return FALSE;
mDisposition=Assume;
return TRUE;
}
inline
void Atom::destroy(void)
{
if(!isOkay())return;
::GlobalDeleteAtom(mhAtom);
mhAtom=0;
mDisposition=None;
}
inline
BOOL Atom::getName(String &strAtomName)const
{
String varAtomName;
if(!isOkay())return FALSE;
varAtomName.reserve(MaxString);
if(!::GlobalGetAtomName(mhAtom,varAtomName,MaxString))return FALSE;
strAtomName=varAtomName;
return !(strAtomName.isNull());
}
inline
BOOL Atom::isOkay(void)const
{
return (mhAtom?TRUE:FALSE);
}
#endif

82
test/Abortdlg.cpp Normal file
View File

@@ -0,0 +1,82 @@
#include <test/abortdlg.hpp>
#include <common/keydata.hpp>
AbortDlg::AbortDlg(void)
: mIsDestroyed(FALSE), mIsCancelled(FALSE)
{
}
AbortDlg::AbortDlg(const AbortDlg &someAbortDlg)
{ // private implementation
*this=someAbortDlg;
}
AbortDlg::~AbortDlg()
{
destroy();
}
AbortDlg &AbortDlg::operator=(const AbortDlg &someAbortDlg)
{ // private implementation
return *this;
}
void AbortDlg::perform(GUIWindow &parentWindow)
{
mIsDestroyed=FALSE;
mIsCancelled=FALSE;
create(parentWindow);
}
void AbortDlg::create(GUIWindow &parentWindow)
{
String buttonName("BUTTON");
DialogTemplate dlgTemplate;
DialogItemTemplate cancelButton;
dlgTemplate.titleText("Printing...");
dlgTemplate.posRect(Rect(10,73,220,42));
dlgTemplate.pointSize(8);
dlgTemplate.typeFace("Helv");
dlgTemplate.style(WS_VISIBLE|WS_CAPTION|DS_3DLOOK|WS_SYSMENU|DS_SETFONT|WS_POPUP);
cancelButton.className(buttonName);
cancelButton.titleText("Cancel");
cancelButton.style(WS_VISIBLE|WS_CHILD|WS_TABSTOP|WS_GROUP);
cancelButton.posRect(Rect(85,22,50,14));
cancelButton.itemID(IDCANCEL);
dlgTemplate+=cancelButton;
createDialog(parentWindow,dlgTemplate,DynamicDialog::ModelessDialog);
}
WORD AbortDlg::dlgCommand(DWORD commandID,CallbackData &someCallbackData)
{
switch(commandID)
{
case IDCANCEL :
mIsCancelled=TRUE;
destroy();
break;
}
return FALSE;
}
BOOL AbortDlg::dlgInitDialog(CallbackData &/*someCallbackData*/)
{
init();
return TRUE;
}
void AbortDlg::dlgDestroyDialog(CallbackData &/*someCallbackData*/)
{
mIsDestroyed=TRUE;
return;
}
// virtuals
void AbortDlg::init(void)
{
}

116
test/Applet1.java Normal file
View File

@@ -0,0 +1,116 @@
import java.awt.*;
import java.applet.*;
/**
* This class reads PARAM tags from its HTML host page and sets
* the color and label properties of the applet. Program execution
* begins with the init() method.
*/
public class Applet1 extends Applet
{
/**
* The entry point for the applet.
*/
public void init()
{
initForm();
usePageParams();
// TODO: Add any constructor code after initForm call.
}
private final String labelParam = "label";
private final String backgroundParam = "background";
private final String foregroundParam = "foreground";
/**
* Reads parameters from the applet's HTML host and sets applet
* properties.
*/
private void usePageParams()
{
final String defaultLabel = "Default label";
final String defaultBackground = "C0C0C0";
final String defaultForeground = "000000";
String labelValue;
String backgroundValue;
String foregroundValue;
/**
* Read the <PARAM NAME="label" VALUE="some string">,
* <PARAM NAME="background" VALUE="rrggbb">,
* and <PARAM NAME="foreground" VALUE="rrggbb"> tags from
* the applet's HTML host.
*/
labelValue = getParameter(labelParam);
backgroundValue = getParameter(backgroundParam);
foregroundValue = getParameter(foregroundParam);
if ((labelValue == null) || (backgroundValue == null) ||
(foregroundValue == null))
{
/**
* There was something wrong with the HTML host tags.
* Generate default values.
*/
labelValue = defaultLabel;
backgroundValue = defaultBackground;
foregroundValue = defaultForeground;
}
/**
* Set the applet's string label, background color, and
* foreground colors.
*/
label1.setText(labelValue);
label1.setBackground(stringToColor(backgroundValue));
label1.setForeground(stringToColor(foregroundValue));
this.setBackground(stringToColor(backgroundValue));
this.setForeground(stringToColor(foregroundValue));
}
/**
* Converts a string formatted as "rrggbb" to an awt.Color object
*/
private Color stringToColor(String paramValue)
{
int red;
int green;
int blue;
red = (Integer.decode("0x" + paramValue.substring(0,2))).intValue();
green = (Integer.decode("0x" + paramValue.substring(2,4))).intValue();
blue = (Integer.decode("0x" + paramValue.substring(4,6))).intValue();
return new Color(red,green,blue);
}
/**
* External interface used by design tools to show properties of an applet.
*/
public String[][] getParameterInfo()
{
String[][] info =
{
{ labelParam, "String", "Label string to be displayed" },
{ backgroundParam, "String", "Background color, format \"rrggbb\"" },
{ foregroundParam, "String", "Foreground color, format \"rrggbb\"" },
};
return info;
}
Label label1 = new Label();
/**
* Intializes values for the applet and its components
*/
void initForm()
{
this.setBackground(Color.lightGray);
this.setForeground(Color.black);
label1.setText("label1");
this.setLayout(new BorderLayout());
this.add("North",label1);
}
}

85
test/CHAR.HPP Normal file
View File

@@ -0,0 +1,85 @@
#ifndef _TEST_CHAR_HPP_
#define _TEST_CHAR_HPP_
typedef char Attribute;
class Char
{
public:
Char(void);
Char(char charData,Attribute attribute=0);
Char(const Char &someChar);
Char &operator=(const Char &someChar);
bool operator==(const Char &someChar)const;
~Char(); // must not be virtual
char getChar(void)const;
void setChar(char someChar);
Attribute getAttribute(void)const;
void setAttribute(Attribute attribute);
private:
char mChar;
Attribute mAttribute;
};
inline
Char::Char(void)
: mChar(0), mAttribute(0)
{
}
inline
Char::Char(char charData,Attribute attribute)
: mChar(charData), mAttribute(attribute)
{
}
inline
Char::Char(const Char &someChar)
: mChar(someChar.mChar), mAttribute(someChar.mAttribute)
{
}
inline
Char::~Char()
{
}
inline
Char &Char::operator=(const Char &someChar)
{
setChar(someChar.getChar());
setAttribute(someChar.getAttribute());
return *this;
}
inline
bool Char::operator==(const Char &someChar)const
{
return (getChar()==someChar.getChar()&&
getAttribute()==someChar.getAttribute());
}
inline
char Char::getChar(void)const
{
return mChar;
}
inline
void Char::setChar(char someChar)
{
mChar=someChar;
}
inline
Attribute Char::getAttribute(void)const
{
return mAttribute;
}
inline
void Char::setAttribute(Attribute attribute)
{
mAttribute=attribute;
}
#endif

1
test/CODEBASE.DAT Normal file
View File

@@ -0,0 +1 @@
file:/d:\work\test

65
test/ChildFrm.cpp Normal file
View File

@@ -0,0 +1,65 @@
// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "test.h"
#include "ChildFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CChildFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
// TODO: add member initialization code here
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CMDIChildWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CChildFrame diagnostics
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CMDIChildWnd::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CMDIChildWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChildFrame message handlers

40
test/ChildFrm.h Normal file
View File

@@ -0,0 +1,40 @@
// ChildFrm.h : interface of the CChildFrame class
//
/////////////////////////////////////////////////////////////////////////////
class CChildFrame : public CMDIChildWnd
{
DECLARE_DYNCREATE(CChildFrame)
public:
CChildFrame();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CChildFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CChildFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
// Generated message map functions
protected:
//{{AFX_MSG(CChildFrame)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

Binary file not shown.

View File

@@ -0,0 +1,21 @@
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet.*;
import java.net.*;
import java.io.*;
import com.ms.security.*;
public class ConnectionManager extends SecurityManager
{
ConnectionManager()
{
super();
}
public void checkConnect(String host, int port)
{
return;
}
};

50
test/DEMO.C Normal file
View File

@@ -0,0 +1,50 @@
/* this file contains the actual definitions of */
/* the IIDs and CLSIDs */
/* link this file in with the server and any clients */
/* File created by MIDL compiler version 3.01.75 */
/* at Fri Sep 24 11:09:58 1999
*/
/* Compiler settings for demo.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: none
*/
//@@MIDL_FILE_HEADING( )
#ifdef __cplusplus
extern "C"{
#endif
#ifndef __IID_DEFINED__
#define __IID_DEFINED__
typedef struct _IID
{
unsigned long x;
unsigned short s1;
unsigned short s2;
unsigned char c[8];
} IID;
#endif // __IID_DEFINED__
#ifndef CLSID_DEFINED
#define CLSID_DEFINED
typedef IID CLSID;
#endif // CLSID_DEFINED
const IID IID_IDemo = {0x994620E2,0x724B,0x11d3,{0xA1,0x28,0xF7,0x39,0xCB,0x1A,0xAC,0x6C}};
const IID LIBID_DemoLib = {0x994620E4,0x724B,0x11d3,{0xA1,0x28,0xF7,0x39,0xCB,0x1A,0xAC,0x6C}};
const CLSID CLSID_Demo = {0x994620E5,0x724B,0x11d3,{0xA1,0x28,0xF7,0x39,0xCB,0x1A,0xAC,0x6C}};
#ifdef __cplusplus
}
#endif

201
test/DEMO.H Normal file
View File

@@ -0,0 +1,201 @@
/* this ALWAYS GENERATED file contains the definitions for the interfaces */
/* File created by MIDL compiler version 3.01.75 */
/* at Fri Sep 24 11:09:58 1999
*/
/* Compiler settings for demo.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: none
*/
//@@MIDL_FILE_HEADING( )
#include "rpc.h"
#include "rpcndr.h"
#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
#ifndef __demo_h__
#define __demo_h__
#ifdef __cplusplus
extern "C"{
#endif
/* Forward Declarations */
#ifndef __IDemo_FWD_DEFINED__
#define __IDemo_FWD_DEFINED__
typedef interface IDemo IDemo;
#endif /* __IDemo_FWD_DEFINED__ */
#ifndef __Demo_FWD_DEFINED__
#define __Demo_FWD_DEFINED__
#ifdef __cplusplus
typedef class Demo Demo;
#else
typedef struct Demo Demo;
#endif /* __cplusplus */
#endif /* __Demo_FWD_DEFINED__ */
/* header files for imported files */
#include "oaidl.h"
#include "ocidl.h"
void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
void __RPC_USER MIDL_user_free( void __RPC_FAR * );
#ifndef __IDemo_INTERFACE_DEFINED__
#define __IDemo_INTERFACE_DEFINED__
/****************************************
* Generated header for interface: IDemo
* at Fri Sep 24 11:09:58 1999
* using MIDL 3.01.75
****************************************/
/* [object][uuid] */
EXTERN_C const IID IID_IDemo;
#if defined(__cplusplus) && !defined(CINTERFACE)
interface DECLSPEC_UUID("994620E2-724B-11d3-A128-F739CB1AAC6C")
IDemo : public IUnknown
{
public:
virtual HRESULT STDMETHODCALLTYPE getValue(
/* [retval][out] */ int __RPC_FAR *pout) = 0;
virtual HRESULT STDMETHODCALLTYPE setValue(
/* [in] */ int value) = 0;
};
#else /* C style interface */
typedef struct IDemoVtbl
{
BEGIN_INTERFACE
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
IDemo __RPC_FAR * This,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
IDemo __RPC_FAR * This);
ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
IDemo __RPC_FAR * This);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *getValue )(
IDemo __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *pout);
HRESULT ( STDMETHODCALLTYPE __RPC_FAR *setValue )(
IDemo __RPC_FAR * This,
/* [in] */ int value);
END_INTERFACE
} IDemoVtbl;
interface IDemo
{
CONST_VTBL struct IDemoVtbl __RPC_FAR *lpVtbl;
};
#ifdef COBJMACROS
#define IDemo_QueryInterface(This,riid,ppvObject) \
(This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
#define IDemo_AddRef(This) \
(This)->lpVtbl -> AddRef(This)
#define IDemo_Release(This) \
(This)->lpVtbl -> Release(This)
#define IDemo_getValue(This,pout) \
(This)->lpVtbl -> getValue(This,pout)
#define IDemo_setValue(This,value) \
(This)->lpVtbl -> setValue(This,value)
#endif /* COBJMACROS */
#endif /* C style interface */
HRESULT STDMETHODCALLTYPE IDemo_getValue_Proxy(
IDemo __RPC_FAR * This,
/* [retval][out] */ int __RPC_FAR *pout);
void __RPC_STUB IDemo_getValue_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
HRESULT STDMETHODCALLTYPE IDemo_setValue_Proxy(
IDemo __RPC_FAR * This,
/* [in] */ int value);
void __RPC_STUB IDemo_setValue_Stub(
IRpcStubBuffer *This,
IRpcChannelBuffer *_pRpcChannelBuffer,
PRPC_MESSAGE _pRpcMessage,
DWORD *_pdwStubPhase);
#endif /* __IDemo_INTERFACE_DEFINED__ */
#ifndef __DemoLib_LIBRARY_DEFINED__
#define __DemoLib_LIBRARY_DEFINED__
/****************************************
* Generated header for library: DemoLib
* at Fri Sep 24 11:09:58 1999
* using MIDL 3.01.75
****************************************/
/* [uuid] */
EXTERN_C const IID LIBID_DemoLib;
#ifdef __cplusplus
EXTERN_C const CLSID CLSID_Demo;
class DECLSPEC_UUID("994620E5-724B-11d3-A128-F739CB1AAC6C")
Demo;
#endif
#endif /* __DemoLib_LIBRARY_DEFINED__ */
/* Additional Prototypes for ALL interfaces */
/* end of Additional Prototypes */
#ifdef __cplusplus
}
#endif
#endif

4
test/DEMO.HPP Normal file
View File

@@ -0,0 +1,4 @@
#ifndef _TEST_DEMO_HPP_
#define _TEST_DEMO_HPP_
#include <test/demo.h>
#endif

33
test/DEMO.IDL Normal file
View File

@@ -0,0 +1,33 @@
import "oaidl.idl";
import "ocidl.idl";
[
uuid(994620E2-724B-11d3-A128-F739CB1AAC6C)
]
interface IDemo : IUnknown
{
HRESULT getValue([out,retval]int *pout);
HRESULT setValue([in] int value);
}
[
uuid(994620E4-724B-11d3-A128-F739CB1AAC6C)
]
library DemoLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
uuid(994620E5-724B-11d3-A128-F739CB1AAC6C)
]
coclass Demo
{
[default] interface IDemo;
};
};

BIN
test/DEMO.TLB Normal file

Binary file not shown.

276
test/DEMO_P.C Normal file
View File

@@ -0,0 +1,276 @@
/* this ALWAYS GENERATED file contains the proxy stub code */
/* File created by MIDL compiler version 3.01.75 */
/* at Fri Sep 24 11:09:58 1999
*/
/* Compiler settings for demo.idl:
Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext
error checks: none
*/
//@@MIDL_FILE_HEADING( )
#define USE_STUBLESS_PROXY
#include "rpcproxy.h"
#include "demo.h"
#define TYPE_FORMAT_STRING_SIZE 5
#define PROC_FORMAT_STRING_SIZE 49
typedef struct _MIDL_TYPE_FORMAT_STRING
{
short Pad;
unsigned char Format[ TYPE_FORMAT_STRING_SIZE ];
} MIDL_TYPE_FORMAT_STRING;
typedef struct _MIDL_PROC_FORMAT_STRING
{
short Pad;
unsigned char Format[ PROC_FORMAT_STRING_SIZE ];
} MIDL_PROC_FORMAT_STRING;
extern const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString;
extern const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString;
/* Object interface: IUnknown, ver. 0.0,
GUID={0x00000000,0x0000,0x0000,{0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46}} */
/* Object interface: IDemo, ver. 0.0,
GUID={0x994620E2,0x724B,0x11d3,{0xA1,0x28,0xF7,0x39,0xCB,0x1A,0xAC,0x6C}} */
extern const MIDL_STUB_DESC Object_StubDesc;
extern const MIDL_SERVER_INFO IDemo_ServerInfo;
#pragma code_seg(".orpc")
static const MIDL_STUB_DESC Object_StubDesc =
{
0,
NdrOleAllocate,
NdrOleFree,
0,
0,
0,
0,
0,
__MIDL_TypeFormatString.Format,
0, /* -error bounds_check flag */
0x20000, /* Ndr library version */
0,
0x301004b, /* MIDL Version 3.1.75 */
0,
0,
0, /* Reserved1 */
0, /* Reserved2 */
0, /* Reserved3 */
0, /* Reserved4 */
0 /* Reserved5 */
};
static const unsigned short IDemo_FormatStringOffsetTable[] =
{
0,
24
};
static const MIDL_SERVER_INFO IDemo_ServerInfo =
{
&Object_StubDesc,
0,
__MIDL_ProcFormatString.Format,
&IDemo_FormatStringOffsetTable[-3],
0,
0,
0,
0
};
static const MIDL_STUBLESS_PROXY_INFO IDemo_ProxyInfo =
{
&Object_StubDesc,
__MIDL_ProcFormatString.Format,
&IDemo_FormatStringOffsetTable[-3],
0,
0,
0
};
CINTERFACE_PROXY_VTABLE(5) _IDemoProxyVtbl =
{
&IDemo_ProxyInfo,
&IID_IDemo,
IUnknown_QueryInterface_Proxy,
IUnknown_AddRef_Proxy,
IUnknown_Release_Proxy ,
(void *)-1 /* IDemo::getValue */ ,
(void *)-1 /* IDemo::setValue */
};
const CInterfaceStubVtbl _IDemoStubVtbl =
{
&IID_IDemo,
&IDemo_ServerInfo,
5,
0, /* pure interpreted */
CStdStubBuffer_METHODS
};
#pragma data_seg(".rdata")
#if !defined(__RPC_WIN32__)
#error Invalid build platform for this stub.
#endif
#if !(TARGET_IS_NT40_OR_LATER)
#error You need a Windows NT 4.0 or later to run this stub because it uses these features:
#error -Oif or -Oicf.
#error However, your C/C++ compilation flags indicate you intend to run this app on earlier systems.
#error This app will die there with the RPC_X_WRONG_STUB_VERSION error.
#endif
static const MIDL_PROC_FORMAT_STRING __MIDL_ProcFormatString =
{
0,
{
/* Procedure getValue */
0x33, /* FC_AUTO_HANDLE */
0x64, /* 100 */
/* 2 */ NdrFcShort( 0x3 ), /* 3 */
#ifndef _ALPHA_
/* 4 */ NdrFcShort( 0xc ), /* x86, MIPS, PPC Stack size/offset = 12 */
#else
NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */
#endif
/* 6 */ NdrFcShort( 0x0 ), /* 0 */
/* 8 */ NdrFcShort( 0x10 ), /* 16 */
/* 10 */ 0x4, /* 4 */
0x2, /* 2 */
/* Parameter pout */
/* 12 */ NdrFcShort( 0x2150 ), /* 8528 */
#ifndef _ALPHA_
/* 14 */ NdrFcShort( 0x4 ), /* x86, MIPS, PPC Stack size/offset = 4 */
#else
NdrFcShort( 0x8 ), /* Alpha Stack size/offset = 8 */
#endif
/* 16 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 18 */ NdrFcShort( 0x70 ), /* 112 */
#ifndef _ALPHA_
/* 20 */ NdrFcShort( 0x8 ), /* x86, MIPS, PPC Stack size/offset = 8 */
#else
NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */
#endif
/* 22 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure setValue */
/* 24 */ 0x33, /* FC_AUTO_HANDLE */
0x64, /* 100 */
/* 26 */ NdrFcShort( 0x4 ), /* 4 */
#ifndef _ALPHA_
/* 28 */ NdrFcShort( 0xc ), /* x86, MIPS, PPC Stack size/offset = 12 */
#else
NdrFcShort( 0x18 ), /* Alpha Stack size/offset = 24 */
#endif
/* 30 */ NdrFcShort( 0x8 ), /* 8 */
/* 32 */ NdrFcShort( 0x8 ), /* 8 */
/* 34 */ 0x4, /* 4 */
0x2, /* 2 */
/* Parameter value */
/* 36 */ NdrFcShort( 0x48 ), /* 72 */
#ifndef _ALPHA_
/* 38 */ NdrFcShort( 0x4 ), /* x86, MIPS, PPC Stack size/offset = 4 */
#else
NdrFcShort( 0x8 ), /* Alpha Stack size/offset = 8 */
#endif
/* 40 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 42 */ NdrFcShort( 0x70 ), /* 112 */
#ifndef _ALPHA_
/* 44 */ NdrFcShort( 0x8 ), /* x86, MIPS, PPC Stack size/offset = 8 */
#else
NdrFcShort( 0x10 ), /* Alpha Stack size/offset = 16 */
#endif
/* 46 */ 0x8, /* FC_LONG */
0x0, /* 0 */
0x0
}
};
static const MIDL_TYPE_FORMAT_STRING __MIDL_TypeFormatString =
{
0,
{
0x11, 0xc, /* FC_RP [alloced_on_stack] [simple_pointer] */
/* 2 */ 0x8, /* FC_LONG */
0x5c, /* FC_PAD */
0x0
}
};
const CInterfaceProxyVtbl * _demo_ProxyVtblList[] =
{
( CInterfaceProxyVtbl *) &_IDemoProxyVtbl,
0
};
const CInterfaceStubVtbl * _demo_StubVtblList[] =
{
( CInterfaceStubVtbl *) &_IDemoStubVtbl,
0
};
PCInterfaceName const _demo_InterfaceNamesList[] =
{
"IDemo",
0
};
#define _demo_CHECK_IID(n) IID_GENERIC_CHECK_IID( _demo, pIID, n)
int __stdcall _demo_IID_Lookup( const IID * pIID, int * pIndex )
{
if(!_demo_CHECK_IID(0))
{
*pIndex = 0;
return 1;
}
return 0;
}
const ExtendedProxyFileInfo demo_ProxyFileInfo =
{
(PCInterfaceProxyVtblList *) & _demo_ProxyVtblList,
(PCInterfaceStubVtblList *) & _demo_StubVtblList,
(const PCInterfaceName * ) & _demo_InterfaceNamesList,
0, // no delegation
& _demo_IID_Lookup,
1,
2
};

37
test/DLLDATA.C Normal file
View File

@@ -0,0 +1,37 @@
/*********************************************************
DllData file -- generated by MIDL compiler
DO NOT ALTER THIS FILE
This file is regenerated by MIDL on every IDL file compile.
To completely reconstruct this file, delete it and rerun MIDL
on all the IDL files in this DLL, specifying this file for the
/dlldata command line option
*********************************************************/
#include <rpcproxy.h>
#ifdef __cplusplus
extern "C" {
#endif
EXTERN_PROXY_FILE( demo )
PROXYFILE_LIST_START
/* Start of list */
REFERENCE_PROXY_FILE( demo ),
/* End of list */
PROXYFILE_LIST_END
DLLDATA_ROUTINES( aProxyFileList, GET_DLL_CLSID )
#ifdef __cplusplus
} /*extern "C" */
#endif
/* end of generated dlldata file */

BIN
test/EXE32.DSW Normal file

Binary file not shown.

3652
test/EXPORT.LOG Normal file

File diff suppressed because it is too large Load Diff

351
test/FILEHELP.CPP Normal file
View File

@@ -0,0 +1,351 @@
#include <dos.h>
#include <io.h>
//#include <dir.h>
#include <string.h>
//#include <mdiwin/main.hpp>
#include <common/string.hpp>
#include <test/test.h>
#include <test/filehelp.hpp>
SelectFile::SelectFile(HWND hParent,Mode readWrite)
: mwFileAttribute((WORD)DefaultAttribute), mhParent(hParent),
mMode(readWrite), mhInstance(processInstance()),
mOwnerDraw(OwnerDraw::UseInstance)
{
mszFileName[0]='\0';
::strcpy(mszDefExt,".DAT");
::strcpy(mszFileSpec,"*.*");
// mLastDrive=::getdisk();
// ::getcwd(mszDirectory,sizeof(mszDirectory));
::strcpy(mszDirectory,"c:\\");
}
SelectFile::~SelectFile()
{
// char Path[132];
// ::wsprintf(Path,"%c:\\",mLastDrive+65);
// ::setdisk(mLastDrive);
// ::strcat(Path,mszDirectory);
// ::chdir(Path);
}
int SelectFile::GetFileName(char *szNameBuf,WORD nMaxChars)
{
WORD returnCode;
returnCode=::DialogBoxParam(mhInstance,(LPSTR)"FileSelect",mhParent,(DLGPROC)DWindow::DlgProc,(LONG)((DWindow*)this));
if(returnCode)
::strncpy(szNameBuf,mszFileName,nMaxChars>sizeof(mszFileName)?sizeof(mszFileName):nMaxChars);
return returnCode;
}
void SelectFile::Initialize()
{
::SendDlgItemMessage(*this,IDS_FNAME,EM_LIMITTEXT,80,0L);
::SendDlgItemMessage(*this,IDS_FLIST,WM_SETREDRAW,FALSE,0L);
waitCursor(TRUE);
::DlgDirList(*this,mszFileSpec,IDS_FLIST,IDS_FPATH,mwFileAttribute);
waitCursor(FALSE);
SetExtended();
::SendDlgItemMessage(GetHandle(),IDS_FLIST,WM_SETREDRAW,TRUE,0L);
::SendMessage(GetDlgItem(GetHandle(),IDS_FLIST),LB_GETTEXT,0,(LONG)mszFileName);
::SendDlgItemMessage(GetHandle(),IDS_FLIST,LB_SETCURSEL,0,0L);
#if defined(__FLAT__)
if(DlgDirSelectExA(GetHandle(),mszFileName,sizeof(mszFileName),IDS_FLIST))
#else
if(DlgDirSelect(GetHandle(),mszFileName,IDS_FLIST))
#endif
::lstrcat(mszFileName,mszFileSpec);
::SetDlgItemText(GetHandle(),IDS_FNAME,mszFileName);
}
void SelectFile::SelChange()
{
#if defined(__FLAT__)
if(DlgDirSelectExA(GetHandle(),mszFileName,sizeof(mszFileName),IDS_FLIST))
#else
if(DlgDirSelect(GetHandle(),mszFileName,IDS_FLIST))
#endif
::lstrcat(mszFileName,mszFileSpec);
::SetDlgItemText(GetHandle(),IDS_FNAME,mszFileName);
}
void SelectFile::DoubleClick()
{
waitCursor(TRUE);
#if defined(__FLAT__)
if(DlgDirSelectExA(GetHandle(),mszFileName,sizeof(mszFileName),IDS_FLIST))
#else
if(DlgDirSelect(GetHandle(),mszFileName,IDS_FLIST))
#endif
{
::lstrcat(mszFileName,mszFileSpec);
::SendDlgItemMessage(GetHandle(),IDS_FLIST,WM_SETREDRAW,FALSE,0L);
::DlgDirList(GetHandle(),mszFileName,IDS_FLIST,IDS_FPATH,mwFileAttribute);
SetExtended();
::SendDlgItemMessage(GetHandle(),IDS_FLIST,WM_SETREDRAW,TRUE,0L);
::SetDlgItemText(GetHandle(),IDS_FNAME,mszFileSpec);
}
else
{
::SetDlgItemText(GetHandle(),IDS_FNAME,mszFileName);
::SendMessage(GetHandle(),WM_COMMAND,IDOK,0L);
}
waitCursor(FALSE);
}
int SelectFile::CheckFileNameSpec()
{
::GetDlgItemText(GetHandle(),IDS_FNAME,mszFileName,sizeof(mszFileName));
mnEditLen=::lstrlen(mszFileName);
mcLastChar=*::AnsiPrev(mszFileName,mszFileName+mnEditLen);
if(mcLastChar=='\\'||mcLastChar==':')::lstrcat(mszFileName,mszFileSpec);
if(lstrchr(mszFileName,'*')||lstrchr(mszFileName,'?'))
{
::SendDlgItemMessage(GetHandle(),IDS_FLIST,WM_SETREDRAW,FALSE,0L);
waitCursor(TRUE);
if(::DlgDirList(GetHandle(),mszFileName,IDS_FLIST,IDS_FPATH,mwFileAttribute))
{
SetExtended();
::strcpy(mszFileSpec,mszFileName);
::SetDlgItemText(GetHandle(),IDS_FNAME,mszFileSpec);
}
else ::MessageBeep(0);
waitCursor(FALSE);
::SendDlgItemMessage(GetHandle(),IDS_FLIST,WM_SETREDRAW,TRUE,0L);
return FALSE;
}
::lstrcat(lstrcat(mszFileName,"\\"),mszFileSpec);
::SendDlgItemMessage(GetHandle(),IDS_FLIST,WM_SETREDRAW,FALSE,0L);
waitCursor(TRUE);
if(::DlgDirList(GetHandle(),mszFileName,IDS_FLIST,IDS_FPATH,mwFileAttribute))
{
waitCursor(FALSE);
SetExtended();
::strcpy(mszFileSpec,mszFileName);
::SetDlgItemText(GetHandle(),IDS_FNAME,mszFileSpec);
return FALSE;
}
waitCursor(FALSE);
::SendDlgItemMessage(GetHandle(),IDS_FLIST,WM_SETREDRAW,TRUE,0L);
mszFileName[mnEditLen]='\0';
if(-1==(mfd=::OpenFile(mszFileName,&mPof,OF_READ|OF_EXIST)))
{
if(Write==mMode)
{
if(-1==(mfd=::OpenFile(mszFileName,&mPof,OF_WRITE|OF_CREATE)))
{
::MessageBeep(0);
return FALSE;
}
::_lclose(mfd);
::unlink(mszFileName);
return TRUE;
}
::lstrcat(mszFileName,mszDefExt);
if(-1==(mfd=::OpenFile(mszFileName,&mPof,OF_READ|OF_EXIST)))
{
::MessageBeep(0);
return FALSE;
}
else ::_lclose(mfd);
}
else ::_lclose(mfd);
::strcpy(mszFileName,mPof.szPathName);
::OemToAnsi(mszFileName,mszFileName);
if(Write==mMode)
{
::MessageBeep(0);
switch(
::MessageBox(GetHandle(),(LPSTR)"Overwrite this file?",(LPSTR)mszFileName,MB_OKCANCEL))
{
case IDOK :
return TRUE;
case IDCANCEL :
return FALSE;
}
}
return TRUE;
}
LPSTR SelectFile::lstrchr(LPSTR str,char ch)
{
while(*str)
{
if(ch==*str)return str;
str=::AnsiNext(str);
}
return NULL;
}
LPSTR SelectFile::lstrrchr(LPSTR str,char ch)
{
LPSTR strl=str+lstrlen(str);
do
{
if(ch==*strl)return strl;
strl=::AnsiPrev(str,strl);
}while(strl>str);
return NULL;
}
int SelectFile::DlgProc(UINT message,WPARAM wParam,LPARAM lParam)
{
switch(message)
{
case WM_INITDIALOG :
{
int TabStopList[3];
WORD DlgWidthUnits;
String windowText;
DlgWidthUnits=LOWORD(::GetDialogBaseUnits())/4;
Main::smhBitmap.associate(IDOK,
String(STRING_BITMAPOKFOCUSUP,mhInstance),
String(STRING_BITMAPOKNOFUP,mhInstance),
String(STRING_BITMAPOKFOCUSDN,mhInstance),OwnerDraw::NOFOCUS);
Main::smhBitmap.associate(IDCANCEL,
String(STRING_BITMAPCAFOCUSUP,mhInstance),
String(STRING_BITMAPCANOFUP,mhInstance),
String(STRING_BITMAPCAFOCUSDN,mhInstance),OwnerDraw::NOFOCUS);
Initialize();
TabStopList[0]=DlgWidthUnits*13*2;
TabStopList[1]=DlgWidthUnits*28*2;
TabStopList[2]=DlgWidthUnits*38*2;
::SendDlgItemMessage(GetHandle(),IDS_FLIST,LB_SETTABSTOPS,3,(LONG)(LPSTR)TabStopList);
::GetDlgItemText(GetHandle(),(Write==mMode?IDS_FILESAVE:IDS_FILEOPEN),windowText,String::MaxString);
::SetWindowText(GetHandle(),windowText);
}
return TRUE;
case WM_DRAWITEM :
switch(((LPDRAWITEMSTRUCT)lParam)->CtlID)
{
case IDOK :
Main::smhBitmap.handleOwnerButton(IDOK,lParam);
return TRUE;
case IDCANCEL :
Main::smhBitmap.handleOwnerButton(IDCANCEL,lParam);
return TRUE;
}
return TRUE;
case WM_COMMAND :
switch(GET_WM_COMMAND_ID(wParam,lParam))
{
case IDS_FLIST :
switch(GET_WM_COMMAND_CMD(wParam,lParam))
{
case LBN_SELCHANGE :
SelChange();
return TRUE;
case LBN_DBLCLK :
DoubleClick();
return TRUE;
}
break;
case IDS_FNAME :
if(GET_WM_COMMAND_CMD(wParam,lParam)==EN_CHANGE)
::EnableWindow(::GetDlgItem(GetHandle(),IDOK),
(BOOL)::SendMessage(GET_WM_COMMAND_HWND(wParam,lParam),
WM_GETTEXTLENGTH,0,0L));
return TRUE;
case IDOK :
if(CheckFileNameSpec())
{
Main::smhBitmap.freeButton(IDOK);
Main::smhBitmap.freeButton(IDCANCEL);
::EndDialog(GetHandle(),TRUE);
}
return TRUE;
case IDCANCEL :
Main::smhBitmap.freeButton(IDOK);
Main::smhBitmap.freeButton(IDCANCEL);
::EndDialog(GetHandle(),FALSE);
return TRUE;
}
}
return FALSE;
}
void SelectFile::SetExtended()
{
HCURSOR hCursor;
ffblk mffblk;
char szBuffer[100];
char szFormat[100];
char minBuf[5];
char hrBuf[5];
char moBuf[5];
char dayBuf[5];
int nIndex=0;
unsigned Year;
unsigned Month;
unsigned Day;
unsigned Hour;
unsigned Minute;
char cAmPm;
int nItems=(int)::SendDlgItemMessage(GetHandle(),IDS_FLIST,LB_GETCOUNT,0,0L);
if(!nItems)return;
hCursor=::SetCursor(::LoadCursor(NULL,IDC_WAIT));
::ShowCursor(TRUE);
for(nIndex=0;nIndex<nItems;nIndex++)
{
::SendDlgItemMessage(GetHandle(),IDS_FLIST,LB_GETTEXT,nIndex,(LPARAM)(LPCSTR)szBuffer);
if(!::findfirst(szBuffer,&mffblk,FA_ARCH))
{
Year=(mffblk.ff_fdate>>9)+1980;
Month=(mffblk.ff_fdate>>5)&0x0F;
Day=mffblk.ff_fdate&0x1F;
Hour=(mffblk.ff_ftime>>11)&0x1F;
Minute=(mffblk.ff_ftime>>5)&0x3F;
if(Hour>=12 && Minute)
{
Hour=Hour==12?1:Hour-12;
if(Hour==12)cAmPm='a';
else cAmPm='p';
}
else
{
if(!Hour)Hour=12;
cAmPm='a';
}
::wsprintf(minBuf,"%d",Minute);
if(1==::lstrlen(minBuf))
{
minBuf[2]='\0';
minBuf[1]=minBuf[0];
minBuf[0]='0';
}
::wsprintf(hrBuf,"%d",Hour);
if(1==::lstrlen(hrBuf))
{
hrBuf[3]='\0';
hrBuf[2]=hrBuf[0];
hrBuf[1]=' ';
hrBuf[0]=' ';
}
::wsprintf(moBuf,"%d",Month);
if(1==::lstrlen(moBuf))
{
moBuf[2]='\0';
moBuf[1]=moBuf[0];
moBuf[0]='0';
}
::wsprintf(dayBuf,"%d",Day);
if(1==::lstrlen(dayBuf))
{
dayBuf[2]='\0';
dayBuf[1]=dayBuf[0];
dayBuf[0]='0';
}
::wsprintf(szFormat,"\t%s-%s-%d\t%9ld\t%s:%s%c",
(LPSTR)moBuf,(LPSTR)dayBuf,Year,mffblk.ff_fsize,(LPSTR)hrBuf,(LPSTR)minBuf,cAmPm);
::lstrcat(szBuffer,szFormat);
::SendDlgItemMessage(GetHandle(),IDS_FLIST,LB_DELETESTRING,nIndex,0L);
::SendDlgItemMessage(GetHandle(),IDS_FLIST,LB_INSERTSTRING,nIndex,(LPARAM)(LPCSTR)szBuffer);
}
}
::ShowCursor(FALSE);
::SetCursor(hCursor);
}


68
test/FILEHELP.HPP Normal file
View File

@@ -0,0 +1,68 @@
#ifndef _FILEHELP_HPP
#define _FILEHELP_HPP
#include <string.h>
#include <common/windows.hpp>
//#include <mdiwin/windowsx.hpp>
#include <common/owner.hpp>
#include <common/dwindow.hpp>
class SelectFile : public DWindow
{
public:
enum Mode{Read,Write};
SelectFile(HWND hParent,Mode readWrite=Read);
~SelectFile();
void SetAttribute(WORD attribute);
void SetExtension(const char * extension);
void SetFileSpec(const char * fileSpec);
int GetFileName(char *buffer,WORD length);
private:
enum {MaxTextLength=96};
enum {DefaultAttribute=0x4010};
int DlgProc(UINT message,WPARAM wParam,LPARAM lParam);
void Initialize();
void SelChange();
void DoubleClick();
void SetExtended();
int CheckFileNameSpec();
LPSTR lstrrchr(LPSTR,char);
LPSTR lstrchr(LPSTR,char);
char mszDefExt[MaxTextLength];
char mszFileName[MaxTextLength];
char mszFileSpec[MaxTextLength];
char mszDirectory[MaxTextLength];
char mcLastChar;
short mnEditLen;
int mLastDrive;
WORD mwFileAttribute;
OFSTRUCT mPof;
HFILE mfd;
HWND mhParent;
HINSTANCE mhInstance;
Mode mMode;
OwnerDraw mOwnerDraw;
};
inline
void SelectFile::SetAttribute(WORD nAttribute)
{
mwFileAttribute=nAttribute;
}
inline
void SelectFile::SetExtension(const char *szExtension)
{
::strncpy(mszDefExt,szExtension,sizeof(mszDefExt)-1);
mszDefExt[sizeof(mszDefExt)-1]='\0';
}
inline
void SelectFile::SetFileSpec(const char *szFileSpec)
{
::strncpy(mszFileSpec,szFileSpec,sizeof(mszFileSpec)-1);
mszFileSpec[sizeof(mszFileSpec)-1]='\0';
}
#endif


191
test/FIND.CPP Normal file
View File

@@ -0,0 +1,191 @@
#include <apispy/find.hpp>
#include <common/keydata.hpp>
Find::Find(void)
: mLastFindIndex(-1)
{
mKeyDownHandler.setCallback(this,&Find::keyDownHandler);
mDlgCodeHandler.setCallback(this,&Find::dlgCodeHandler);
mEditHook.insertHandler(WinHookProc::KeyDownHandler,&mKeyDownHandler);
mEditHook.insertHandler(WinHookProc::DialogCodeHandler,&mDlgCodeHandler);
}
Find::Find(const Find &find)
{ // private implementation
*this=find;
}
Find::~Find()
{
mEditHook.removeHandler(WinHookProc::KeyDownHandler,&mKeyDownHandler);
mEditHook.removeHandler(WinHookProc::DialogCodeHandler,&mDlgCodeHandler);
}
Find &Find::operator=(const Find &find)
{ // private implementation
return *this;
}
void Find::perform(GUIWindow &parentWindow)
{
create(parentWindow);
}
void Find::create(GUIWindow &parentWindow)
{
String staticName("STATIC");
String editName("EDIT");
String buttonName("BUTTON");
DialogTemplate dlgTemplate;
DialogItemTemplate staticFind;
DialogItemTemplate editFind;
DialogItemTemplate cancelButton;
DialogItemTemplate fnButton;
DialogItemTemplate wmButton;
dlgTemplate.titleText("Find");
dlgTemplate.posRect(Rect(10,73,236,62));
dlgTemplate.pointSize(8);
dlgTemplate.typeFace("Helv");
dlgTemplate.style(DS_MODALFRAME|WS_VISIBLE|WS_CAPTION|DS_3DLOOK|WS_SYSMENU|DS_SETFONT|WS_POPUP); // WS_POPUP
staticFind.className(staticName);
staticFind.titleText("Fi&nd what:");
staticFind.style(WS_CHILD|WS_VISIBLE);
staticFind.posRect(Rect(4,8,42,8));
staticFind.itemID(-1);
editFind.className(editName);
editFind.titleText("");
editFind.style(WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL|WS_BORDER|WS_TABSTOP|WS_GROUP);
editFind.posRect(Rect(47,7,128,12));
editFind.itemID(FindText);
fnButton.className(buttonName);
fnButton.titleText("&Find Next");
fnButton.style(WS_VISIBLE|WS_CHILD|WS_TABSTOP|WS_GROUP|BS_DEFPUSHBUTTON);
fnButton.posRect(Rect(182,5,50,14));
fnButton.itemID(FindNext);
wmButton.className(buttonName);
wmButton.titleText("Match &whole word only");
wmButton.style(WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_AUTOCHECKBOX|WS_GROUP);
wmButton.posRect(Rect(4,26,100,12));
wmButton.itemID(FindWhole);
cancelButton.className(buttonName);
cancelButton.titleText("Cancel");
cancelButton.style(WS_VISIBLE|WS_CHILD|WS_TABSTOP|WS_GROUP);
cancelButton.posRect(Rect(182,23,50,14));
cancelButton.itemID(CancelFind);
dlgTemplate+=staticFind;
dlgTemplate+=editFind;
dlgTemplate+=cancelButton;
dlgTemplate+=fnButton;
dlgTemplate+=wmButton;
createDialog(parentWindow,dlgTemplate,DynamicDialog::ModelessDialog);
}
CallbackData::ReturnType Find::keyDownHandler(CallbackData &someCallbackData)
{
KeyData keyData(someCallbackData);
String strEditText;
if(!keyData.isEnterKey())return (CallbackData::ReturnType)FALSE;
getText(strEditText);
leaveEdit(strEditText);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType Find::dlgCodeHandler(CallbackData &someCallbackData)
{
return (CallbackData::ReturnType)DLGC_WANTALLKEYS;
}
WORD Find::dlgCommand(DWORD commandID,CallbackData &someCallbackData)
{
switch(commandID)
{
case FindText :
break;
case FindNext :
handleFindNext();
break;
case CancelFind :
destroy();
break;
}
return FALSE;
}
WORD Find::dlgCode(CallbackData &someCallbackData)
{
return DLGC_WANTALLKEYS;
}
BOOL Find::dlgInitDialog(CallbackData &/*someCallbackData*/)
{
mEditHook.hookWin(getItem(FindText));
init();
return TRUE;
}
void Find::dlgDestroyDialog(CallbackData &/*someCallbackData*/)
{
mEditHook.unhookWin();
return;
}
void Find::getText(String &strEditText)
{
String strText;
DynamicDialog::getText(FindText,strText);
strEditText=strText;
}
BOOL Find::matchWholeWordOnly(void)const
{
return ::SendMessage(getItem(FindWhole),BM_GETCHECK,0,0L);
}
void Find::handleFind(void)
{
find();
}
void Find::handleFindNext(void)
{
findNext();
}
// virtuals
void Find::init(void)
{
}
void Find::find(void)
{
String currText;
getText(currText);
lastSearchText(currText);
}
void Find::findNext(void)
{
String currText;
getText(currText);
lastSearchText(currText);
}
void Find::leaveEdit(const String &strEditText)
{
lastSearchText(strEditText);
}

74
test/FIND.HPP Normal file
View File

@@ -0,0 +1,74 @@
#ifndef _APISPY_FIND_HPP_
#define _APISPY_FIND_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _DIALOG_DYNAMICDIALOG_HPP_
#include <dialog/dyndlg.hpp>
#endif
#ifndef _COMMON_HOOKPROC_HPP_
#include <common/hookproc.hpp>
#endif
class Find : private DynamicDialog
{
public:
Find(void);
virtual ~Find();
void perform(GUIWindow &parentWindow);
int lastFindIndex(void)const;
const String &lastSearchText(void)const;
protected:
virtual void init(void);
virtual void find(void);
virtual void findNext(void);
virtual void leaveEdit(const String &strText);
void getText(String &strEditText);
void lastFindIndex(int lastFindIndex);
void lastSearchText(const String &lastSearchText);
BOOL matchWholeWordOnly(void)const;
private:
enum{FindText=101,CancelFind=IDCANCEL,FindNext=103,FindWhole=104};
Find(const Find &find);
Find &operator=(const Find &find);
CallbackData::ReturnType keyDownHandler(CallbackData &someCallbackData);
CallbackData::ReturnType dlgCodeHandler(CallbackData &someCallbackData);
void handleFind(void);
void handleFindNext(void);
void create(GUIWindow &parentWindow);
WORD dlgCommand(DWORD commandID,CallbackData &someCallbackData);
WORD dlgCode(CallbackData &someCallbackData);
BOOL dlgInitDialog(CallbackData &someCallbackData);
void dlgDestroyDialog(CallbackData &someCallbackData);
Callback<Find> mKeyDownHandler;
Callback<Find> mDlgCodeHandler;
String mLastSearchText;
int mLastFindIndex;
WinHookProc mEditHook;
};
inline
const String &Find::lastSearchText(void)const
{
return mLastSearchText;
}
inline
void Find::lastSearchText(const String &lastSearchText)
{
mLastSearchText=lastSearchText;
}
inline
void Find::lastFindIndex(int lastFindIndex)
{
mLastFindIndex=lastFindIndex;
}
inline
int Find::lastFindIndex(void)const
{
return mLastFindIndex;
}
#endif

55
test/Form1.java Normal file
View File

@@ -0,0 +1,55 @@
import com.ms.wfc.app.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
import com.ms.wfc.html.*;
/**
* This class can take a variable number of parameters on the command
* line. Program execution begins with the main() method. The class
* constructor is not invoked unless an object of type 'Form1' is
* created in the main() method.
*/
public class Form1 extends Form
{
public Form1()
{
// Required for Visual J++ Form Designer support
initForm();
// TODO: Add any constructor code after initForm call
}
/**
* Form1 overrides dispose so it can clean up the
* component list.
*/
public void dispose()
{
super.dispose();
components.dispose();
}
/**
* NOTE: The following code is required by the Visual J++ form
* designer. It can be modified using the form editor. Do not
* modify it using the code editor.
*/
Container components = new Container();
private void initForm()
{
this.setSize (new Point(300,300));
this.setText ("Form1");
}
/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main(String args[])
{
Application.run(new Form1());
}
}

BIN
test/Fund.suo Normal file

Binary file not shown.

BIN
test/Fund.vjp Normal file

Binary file not shown.

5
test/INPROC.DEF Normal file
View File

@@ -0,0 +1,5 @@
LIBRARY INPROC.DLL
EXPORTS
DllCanUnloadNow @1 PRIVATE
DllGetClassObject @2 PRIVATE

29
test/INPROC.DSW Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "inproc"=.\inproc.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

233
test/INPROC.MAK Normal file
View File

@@ -0,0 +1,233 @@
# Microsoft Developer Studio Generated NMAKE File, Based on inproc.dsp
!IF "$(CFG)" == ""
CFG=inproc - Win32 Debug
!MESSAGE No configuration specified. Defaulting to inproc - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "inproc - Win32 Release" && "$(CFG)" != "inproc - Win32 Debug"
!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 "inproc.mak" CFG="inproc - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "inproc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "inproc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "inproc - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\inproc.dll"
!ELSE
ALL : "$(OUTDIR)\inproc.dll"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\demo.obj"
-@erase "$(INTDIR)\test.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(OUTDIR)\inproc.dll"
-@erase "$(OUTDIR)\inproc.exp"
-@erase "$(OUTDIR)\inproc.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\inproc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\inproc.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\
/pdb:"$(OUTDIR)\inproc.pdb" /machine:I386 /def:".\inproc.def"\
/out:"$(OUTDIR)\inproc.dll" /implib:"$(OUTDIR)\inproc.lib"
DEF_FILE= \
".\inproc.def"
LINK32_OBJS= \
"$(INTDIR)\demo.obj" \
"$(INTDIR)\test.obj" \
"..\com\msvcobj\inproc.lib" \
"..\Exe\mscommon.lib"
"$(OUTDIR)\inproc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "inproc - Win32 Debug"
OUTDIR=.\msvcobj
INTDIR=.\msvcobj
# Begin Custom Macros
OutDir=.\msvcobj
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\inproc.dll"
!ELSE
ALL : "$(OUTDIR)\inproc.dll"
!ENDIF
CLEAN :
-@erase "$(INTDIR)\demo.obj"
-@erase "$(INTDIR)\test.obj"
-@erase "$(INTDIR)\vc50.idb"
-@erase "$(INTDIR)\vc50.pdb"
-@erase "$(OUTDIR)\inproc.dll"
-@erase "$(OUTDIR)\inproc.exp"
-@erase "$(OUTDIR)\inproc.ilk"
-@erase "$(OUTDIR)\inproc.lib"
-@erase "$(OUTDIR)\inproc.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\inproc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\msvcobj/
CPP_SBRS=.
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\inproc.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes\
/pdb:"$(OUTDIR)\inproc.pdb" /debug /machine:I386 /def:".\inproc.def"\
/out:"$(OUTDIR)\inproc.dll" /implib:"$(OUTDIR)\inproc.lib" /pdbtype:sept
DEF_FILE= \
".\inproc.def"
LINK32_OBJS= \
"$(INTDIR)\demo.obj" \
"$(INTDIR)\test.obj" \
"..\com\msvcobj\inproc.lib" \
"..\Exe\mscommon.lib"
"$(OUTDIR)\inproc.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
!IF "$(CFG)" == "inproc - Win32 Release" || "$(CFG)" == "inproc - Win32 Debug"
SOURCE=.\demo.c
"$(INTDIR)\demo.obj" : $(SOURCE) "$(INTDIR)"
SOURCE=.\test.cpp
!IF "$(CFG)" == "inproc - Win32 Release"
DEP_CPP_TEST_=\
".\demo.h"\
".\demo.hpp"\
{$(INCLUDE)}"com\clsctx.hpp"\
{$(INCLUDE)}"com\com.hpp"\
{$(INCLUDE)}"com\initguid.hpp"\
{$(INCLUDE)}"com\inproc.hpp"\
{$(INCLUDE)}"com\ole2.hpp"\
{$(INCLUDE)}"com\result.hpp"\
{$(INCLUDE)}"common\pointer.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
!ELSEIF "$(CFG)" == "inproc - Win32 Debug"
DEP_CPP_TEST_=\
"..\..\parts\mssdk\include\basetsd.h"\
"..\..\parts\mssdk\include\msxml.h"\
"..\..\parts\mssdk\include\rpcasync.h"\
".\demo.h"\
".\demo.hpp"\
{$(INCLUDE)}"com\clsctx.hpp"\
{$(INCLUDE)}"com\com.hpp"\
{$(INCLUDE)}"com\initguid.hpp"\
{$(INCLUDE)}"com\inproc.hpp"\
{$(INCLUDE)}"com\ole2.hpp"\
{$(INCLUDE)}"com\result.hpp"\
{$(INCLUDE)}"common\pointer.hpp"\
{$(INCLUDE)}"common\windows.hpp"\
"$(INTDIR)\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
!ENDIF
!ENDIF

15
test/INPROC.PLG Normal file
View File

@@ -0,0 +1,15 @@
--------------------Configuration: inproc - Win32 Debug--------------------
Begining build with project "E:\work\TEST\inproc.dsp", with item "inproc.cpp"
Active configuration is Win32 (x86) Dynamic-Link Library (based on Win32 (x86) Dynamic-Link Library)
Creating temp file "E:\WINDOWS\TEMP\RSP80B2.TMP" with contents </nologo /MTd /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /Fp"msvcobj/inproc.pch" /YX /Fo"msvcobj/" /Fd"msvcobj/" /FD /c
"E:\work\Test\inproc.cpp"
>
Creating command line "cl.exe @E:\WINDOWS\TEMP\RSP80B2.TMP"
Compiling...
inproc.cpp
inproc.obj - 0 error(s), 0 warning(s)

147
test/INTERCPT.CPP Normal file
View File

@@ -0,0 +1,147 @@
#include <test/intercpt.hpp>
WORD Intercept::performIntercept(PureVector<PureImport> &pureImports,DWORD baseAddress)
{
mBaseAddress=baseAddress;
loadImportDescriptors(pureImports);
moduleEntryPoints();
resolveImportNames(pureImports);
mImportModuleNames.remove();
size(0);
return TRUE;
}
void Intercept::loadImportDescriptors(PureVector<PureImport> &pureImports)
{
Block<String> moduleNameStrings;
DWORD importCount(pureImports.size());
loadImportModuleNames();
for(long importIndex=0;importIndex<importCount;importIndex++)importEntryPoint(pureImports[importIndex]);
}
void Intercept::loadImportModuleNames(void)
{
PIMAGE_DOS_HEADER npImageDosHeader;
PIMAGE_NT_HEADERS npImageNTHeader;
PIMAGE_IMPORT_DESCRIPTOR npImageImportDescriptor;
String moduleString;
mImportModuleNames.remove();
npImageDosHeader=(PIMAGE_DOS_HEADER)baseAddress();
if(::IsBadReadPtr((void*)baseAddress(),sizeof(PIMAGE_NT_HEADERS)))return;
if(npImageDosHeader->e_magic!=IMAGE_DOS_SIGNATURE)return;
npImageNTHeader=(PIMAGE_NT_HEADERS)((char*)npImageDosHeader+npImageDosHeader->e_lfanew);
if(npImageNTHeader->Signature!=IMAGE_NT_SIGNATURE)return;
npImageImportDescriptor=(PIMAGE_IMPORT_DESCRIPTOR)((char*)baseAddress()+npImageNTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
if((char*)npImageImportDescriptor==(char*)npImageNTHeader)return;
while(npImageImportDescriptor->Name)
{
moduleString=(char*)(baseAddress()+npImageImportDescriptor->Name);
moduleString=moduleString.betweenString(0,'.');
moduleString.upper();
mImportModuleNames.insert(&moduleString);
npImageImportDescriptor++;
}
}
WORD Intercept::importEntryPoint(PureImport &pureImport)
{
DWORD entryPoint;
if(!pureImport.moduleName().isNull())
{
if(0!=(entryPoint=(DWORD)::GetProcAddress(::GetModuleHandle(pureImport.moduleName()),pureImport.importName())))
{
if(isWIN95Thunk((DWORD)entryPoint))pureImport.importAddress(*((DWORD*)(((char*)entryPoint)+1)));
else pureImport.importAddress(entryPoint);
// else pureImport.importAddress(*((DWORD*)entryPoint));
return TRUE;
}
}
for(short moduleIndex=0;moduleIndex<mImportModuleNames.size();moduleIndex++)
{
if(0!=(entryPoint=(DWORD)::GetProcAddress(::GetModuleHandle(mImportModuleNames[moduleIndex]),pureImport.importName())))
{
pureImport.moduleName(mImportModuleNames[moduleIndex]);
if(isWIN95Thunk((DWORD)entryPoint))pureImport.importAddress(*((DWORD*)(((char*)entryPoint)+1)));
else pureImport.importAddress(entryPoint);
// else pureImport.importAddress(*((DWORD*)entryPoint));
return TRUE;
}
}
return FALSE;
}
void Intercept::moduleEntryPoints(void)
{
PIMAGE_DOS_HEADER npImageDosHeader;
PIMAGE_NT_HEADERS npImageNTHeader;
PIMAGE_IMPORT_DESCRIPTOR npImageImportDescriptor;
PIMAGE_THUNK_DATA pThunk;
String moduleName;
DWORD importIndex(0);
DWORD importCount(0);
QuickSort<PureImport> sortImport;
npImageDosHeader=(PIMAGE_DOS_HEADER)baseAddress();
if(::IsBadReadPtr((void*)baseAddress(),sizeof(PIMAGE_NT_HEADERS)))return;
if(npImageDosHeader->e_magic!=IMAGE_DOS_SIGNATURE)return;
npImageNTHeader=(PIMAGE_NT_HEADERS)((char*)npImageDosHeader+npImageDosHeader->e_lfanew);
if(npImageNTHeader->Signature!=IMAGE_NT_SIGNATURE)return;
npImageImportDescriptor=(PIMAGE_IMPORT_DESCRIPTOR)((char*)baseAddress()+npImageNTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
if((char*)npImageImportDescriptor==(char*)npImageNTHeader)return;
while(npImageImportDescriptor->Name)
{
pThunk=(PIMAGE_THUNK_DATA)(baseAddress()+(DWORD)npImageImportDescriptor->FirstThunk);
while(pThunk->u1.Function){importCount++;pThunk++;}
npImageImportDescriptor++;
}
npImageImportDescriptor=(PIMAGE_IMPORT_DESCRIPTOR)((char*)baseAddress()+npImageNTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress);
size(importCount);
while(npImageImportDescriptor->Name)
{
pThunk=(PIMAGE_THUNK_DATA)(baseAddress()+(DWORD)npImageImportDescriptor->FirstThunk);
moduleName=(char*)(baseAddress()+npImageImportDescriptor->Name);
while(pThunk->u1.Function)
{
if(isWIN95Thunk((DWORD)pThunk->u1.Function))
{
operator[](importIndex).moduleName(moduleName);
operator[](importIndex).importAddress(*((DWORD*)((char*)(((DWORD)pThunk->u1.Function)+1))));
operator[](importIndex).rewriteAddress((DWORD)&(*((DWORD*)((char*)(((DWORD)pThunk->u1.Function)+1)))));
operator[](importIndex).thunkType(PureImport::WIN95Thunk);
importIndex++;
}
else
{
operator[](importIndex).moduleName(moduleName);
operator[](importIndex).importAddress((DWORD)pThunk->u1.Function);
operator[](importIndex).rewriteAddress((DWORD)&(pThunk->u1.Function));
operator[](importIndex).thunkType(PureImport::StandardThunk);
importIndex++;
}
pThunk++;
}
npImageImportDescriptor++;
}
sortImport.sortItems((PureVector<PureImport>&)*this);
}
void Intercept::resolveImportNames(PureVector<PureImport> &pureImport)
{
PureImport moduleImport;
DWORD importCount(pureImport.size());
BinarySearch<PureImport> searchImport((PureVector<PureImport>&)*this);
for(long importIndex=0;importIndex<importCount;importIndex++)
{
if(searchImport.searchItem(pureImport[importIndex],moduleImport))
{
pureImport[importIndex].importAddress(moduleImport.importAddress());
pureImport[importIndex].rewriteAddress(moduleImport.rewriteAddress());
pureImport[importIndex].thunkType(moduleImport.thunkType());
}
else pureImport[importIndex].rewriteAddress(0L);
}
}

52
test/INTERCPT.HPP Normal file
View File

@@ -0,0 +1,52 @@
#ifndef _APISPY_INTERCEPT_HPP_
#define _APISPY_INTERCEPT_HPP_
#include <common/windows.hpp>
#include <common/block.hpp>
#include <common/pvector.hpp>
#include <common/qsort.hpp>
#include <common/binsrch.hpp>
#include <image/pureimp.hpp>
class Intercept : public PureVector<PureImport>
{
public:
Intercept(void);
~Intercept();
WORD performIntercept(PureVector<PureImport> &pureImports,DWORD baseAddress);
private:
void loadImportDescriptors(PureVector<PureImport> &pureImports);
void loadImportModuleNames(void);
void moduleEntryPoints(void);
void resolveImportNames(PureVector<PureImport> &pureImport);
WORD importEntryPoint(PureImport &pureImport);
DWORD baseAddress(void)const;
WORD isWIN95Thunk(DWORD baseAddress);
DWORD mBaseAddress;
Block<String> mImportModuleNames;
};
inline
Intercept::Intercept(void)
{
}
inline
Intercept::~Intercept()
{
}
inline
DWORD Intercept::baseAddress(void)const
{
return mBaseAddress;
}
inline
WORD Intercept::isWIN95Thunk(DWORD baseAddress)
{
if(*((BYTE*)baseAddress)==0x68&&*(((BYTE*)baseAddress)+5)==0xE9)return TRUE;
return FALSE;
}
#endif

BIN
test/LAUNCH32.DSW Normal file

Binary file not shown.

BIN
test/LAUNCH32.IDE Normal file

Binary file not shown.

66
test/MAIN.HPP Normal file
View File

@@ -0,0 +1,66 @@
#ifndef _TEST_MAIN_HPP_
#define _TEST_MAIN_HPP_
#include <common/windows.hpp>
class Main
{
public:
static HINSTANCE processInstance(HWND hWnd);
static HINSTANCE processInstance(void);
static HINSTANCE previousProcessInstance(void);
static void processInstance(HINSTANCE processInstance);
static void previousProcessInstance(HINSTANCE previousProcessInstance);
static void cmdShow(int nCmdShow);
private:
static HINSTANCE smhInstance;
static HINSTANCE smhPrevInstance;
static int smnCmdShow;
};
inline
void Main::processInstance(HINSTANCE hProcessInstance)
{
smhInstance=hProcessInstance;
}
inline
void Main::previousProcessInstance(HINSTANCE previousProcessInstance)
{
smhPrevInstance=previousProcessInstance;
}
inline
void Main::cmdShow(int nCmdShow)
{
}
inline
HINSTANCE Main::processInstance(void)
{
return smhInstance;
}
inline
HINSTANCE Main::previousProcessInstance(void)
{
return smhPrevInstance;
}
#if defined(__FLAT__)
inline
HINSTANCE Main::processInstance(HWND hWnd)
{
return (HINSTANCE)::GetWindowLong(hWnd,GWL_HINSTANCE);
}
#else
inline
HINSTANCE Main::processInstance(HWND hWnd)
{
return (HINSTANCE)::GetWindowWord(hWnd,GWW_HINSTANCE);
}
#endif
#define WM_REACTIVATE WM_USER+1
#endif


53
test/MAINWND.HPP Normal file
View File

@@ -0,0 +1,53 @@
#ifndef _TEST_MAINWINDOW_HPP_
#define _TEST_MAINWINDOW_HPP_
#ifndef _COMMON_WINDOW_HPP_
#include <common/window.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
class MainWindow : public Window
{
public:
MainWindow(void);
virtual ~MainWindow();
static String className(void);
private:
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
CallbackData::ReturnType commandHandler(CallbackData &someCallbackData);
CallbackData::ReturnType keyDownHandler(CallbackData &someCallbackData);
CallbackData::ReturnType sizeHandler(CallbackData &someCallbackData);
CallbackData::ReturnType timerHandler(CallbackData &someCallbackData);
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
CallbackData::ReturnType activateAppHandler(CallbackData &someCallbackData);
CallbackData::ReturnType displayChangeHandler(CallbackData &someCallbackData);
void registerClass(void)const;
void insertHandlers(void);
void removeHandlers(void);
void handleFilePrint(void);
void handleFileOpen(void);
Callback<MainWindow> mActivateAppHandler;
Callback<MainWindow> mDisplayChangeHandler;
Callback<MainWindow> mPaintHandler;
Callback<MainWindow> mDestroyHandler;
Callback<MainWindow> mCommandHandler;
Callback<MainWindow> mKeyDownHandler;
Callback<MainWindow> mSizeHandler;
Callback<MainWindow> mTimerHandler;
Callback<MainWindow> mCreateHandler;
static char szClassName[];
static char szMenuName[];
};
inline
String MainWindow::className(void)
{
return String(szClassName);
}
#endif

BIN
test/MSTEST.DSW Normal file

Binary file not shown.

BIN
test/MSTEST.IDE Normal file

Binary file not shown.

11
test/Main.cpp Normal file
View File

@@ -0,0 +1,11 @@
#include <common/windows.hpp>
int main(int argc,char **argv)
{
for(int index=0;index<argc;index++)
{
::MessageBox(0,(LPSTR)argv[0],(LPSTR)"Args",MB_OK);
}
return 0;
}

107
test/MainFrm.cpp Normal file
View File

@@ -0,0 +1,107 @@
// MainFrm.cpp : implementation of the CMainFrame class
//
#include "stdafx.h"
#include "test.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMainFrame
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
//{{AFX_MSG_MAP(CMainFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code !
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
static UINT indicators[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
/////////////////////////////////////////////////////////////////////////////
// CMainFrame construction/destruction
CMainFrame::CMainFrame()
{
// TODO: add member initialization code here
}
CMainFrame::~CMainFrame()
{
}
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
if (!m_wndToolBar.Create(this) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_wndStatusBar.Create(this) ||
!m_wndStatusBar.SetIndicators(indicators,
sizeof(indicators)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// TODO: Remove this if you don't want tool tips or a resizeable toolbar
m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
// TODO: Delete these three lines if you don't want the toolbar to
// be dockable
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndToolBar);
return 0;
}
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CMDIFrameWnd::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMainFrame diagnostics
#ifdef _DEBUG
void CMainFrame::AssertValid() const
{
CMDIFrameWnd::AssertValid();
}
void CMainFrame::Dump(CDumpContext& dc) const
{
CMDIFrameWnd::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

45
test/MainFrm.h Normal file
View File

@@ -0,0 +1,45 @@
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
class CMainFrame : public CMDIFrameWnd
{
DECLARE_DYNAMIC(CMainFrame)
public:
CMainFrame();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////

147
test/Mainwnd.cpp Normal file
View File

@@ -0,0 +1,147 @@
#include <test/mainwnd.hpp>
#include <test/test.h>
#include <common/assert.hpp>
char MainWindow::szClassName[]="Proto";
char MainWindow::szMenuName[]="mainMenu";
MainWindow::MainWindow(void)
{
mPaintHandler.setCallback(this,&MainWindow::paintHandler);
mDestroyHandler.setCallback(this,&MainWindow::destroyHandler);
mCommandHandler.setCallback(this,&MainWindow::commandHandler);
mKeyDownHandler.setCallback(this,&MainWindow::keyDownHandler);
mSizeHandler.setCallback(this,&MainWindow::sizeHandler);
mCreateHandler.setCallback(this,&MainWindow::createHandler);
mTimerHandler.setCallback(this,&MainWindow::timerHandler);
mActivateAppHandler.setCallback(this,&MainWindow::activateAppHandler);
mDisplayChangeHandler.setCallback(this,&MainWindow::displayChangeHandler);
insertHandlers();
registerClass();
::CreateWindow(szClassName,szClassName,
WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_DLGFRAME|WS_CLIPCHILDREN|WS_SIZEBOX,
CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,CW_USEDEFAULT,
NULL,NULL,processInstance(),(LPSTR)this);
show(SW_SHOW);
update();
}
MainWindow::~MainWindow()
{
destroy();
}
void MainWindow::insertHandlers(void)
{
insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
insertHandler(VectorHandler::PaintHandler,&mPaintHandler);
insertHandler(VectorHandler::CommandHandler,&mCommandHandler);
insertHandler(VectorHandler::SizeHandler,&mSizeHandler);
insertHandler(VectorHandler::KeyDownHandler,&mKeyDownHandler);
insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
insertHandler(VectorHandler::TimerHandler,&mTimerHandler);
// insertHandler(VectorHandler::ActivateAppHandler,&mActivateAppHandler);
// insertHandler(VectorHandler::DisplayChangeHandler,&mDisplayChangeHandler);
}
void MainWindow::removeHandlers(void)
{
removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
removeHandler(VectorHandler::PaintHandler,&mPaintHandler);
removeHandler(VectorHandler::CommandHandler,&mCommandHandler);
removeHandler(VectorHandler::SizeHandler,&mSizeHandler);
removeHandler(VectorHandler::KeyDownHandler,&mKeyDownHandler);
removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
removeHandler(VectorHandler::TimerHandler,&mTimerHandler);
// removeHandler(VectorHandler::ActivateAppHandler,&mActivateAppHandler);
// removeHandler(VectorHandler::DisplayChangeHandler,&mDisplayChangeHandler);
}
void MainWindow::registerClass(void)const
{
WNDCLASS wndClass;
if(::GetClassInfo(processInstance(),className(),(WNDCLASS FAR*)&wndClass))return;
wndClass.style =CS_HREDRAW|CS_VREDRAW; //|CS_OWNDC|CS_DBLCLKS;
wndClass.lpfnWndProc =(WNDPROC)Window::WndProc;
wndClass.cbClsExtra =0;
wndClass.cbWndExtra =sizeof(MainWindow*);
wndClass.hInstance =processInstance();
wndClass.hIcon =::LoadIcon(NULL,IDI_APPLICATION);
wndClass.hCursor =::LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground =(HBRUSH)::GetStockObject(WHITE_BRUSH);
wndClass.lpszMenuName =szMenuName;
wndClass.lpszClassName =szClassName;
::RegisterClass(&wndClass);
assert(0!=::GetClassInfo(processInstance(),className(),(WNDCLASS FAR*)&wndClass));
}
CallbackData::ReturnType MainWindow::createHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::destroyHandler(CallbackData &/*someCallbackData*/)
{
removeHandlers();
::PostQuitMessage(0);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::activateAppHandler(CallbackData &someCallbackData)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::displayChangeHandler(CallbackData &someCallbackData)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::sizeHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::commandHandler(CallbackData &someCallbackData)
{
switch(someCallbackData.wmCommandID())
{
case MAINMENU_FILEPRINT :
handleFilePrint();
break;
case MAINMENU_FILEOPEN :
handleFileOpen();
break;
default :
break;
}
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::paintHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::timerHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType MainWindow::keyDownHandler(CallbackData &/*someCallbackData*/)
{
return (CallbackData::ReturnType)FALSE;
}
void MainWindow::handleFilePrint(void)
{
}
void MainWindow::handleFileOpen(void)
{
return;
}

77
test/PAGE.CPP Normal file
View File

@@ -0,0 +1,77 @@
#include <test/page.hpp>
PurePage::PurePage(int rows,int cols)
{
createPage(rows,cols);
setState(Created);
}
PurePage::PurePage(const PurePage &somePurePage)
{
*this=somePurePage;
}
PurePage::~PurePage()
{
}
PurePage &PurePage::operator=(const PurePage &somePurePage)
{
return *this;
}
bool PurePage::operator==(const PurePage &somePurePage)const
{
return false;
}
bool PurePage::setAt(Page &page)
{
return false;
}
bool PurePage::getAt(int row,int col,Char &charData)
{
return false;
}
bool PurePage::getAt(int row,Row &rowData)
{
return false;
}
bool PurePage::setAt(int row,int col,Char &charData)
{
return false;
}
bool PurePage::setAt(int row,Row &rowData)
{
return false;
}
void PurePage::setState(State state)
{
mState|=int(state);
}
void PurePage::clearState(State state)
{
mState|=int(~state);
}
bool PurePage::queryState(State state)const
{
return mState&state;
}
void PurePage::createPage(int rows,int cols)
{
mPage.reserve(rows);
for(int index=0;index<rows;index++)mPage[index].reserve(cols);
}
bool PurePage::copyPage(Page &page)
{
return false;
}

182
test/PAGE.HPP Normal file
View File

@@ -0,0 +1,182 @@
#ifndef _TEST_PAGE_HPP_
#define _TEST_PAGE_HPP_
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef __SGI_STL_VECTOR_H
#include <sgi_stl/vector.h>
#endif
typedef vector<char> CharRow;
typedef vector<Attribute> AttributeRow;
typedef vector<CharRow> PageData;
typedef vector<AttributeRow> PageAttributes;
typedef SmartPointer<CharRow> CharRowPointer;
typedef SmartPointer<AttributeRow> AttributeRowPointer;
typedef SmartPointer<PageData> PageDataPointer;
typedef SmartPointer<PageAttributes> PageAttributesPointer;
class PurePage
{
public:
enum{InitialRows=25,InitialCols=80};
enum State{Created=0x0001,Updated=0x0002,Clear=0x0004,Published=0x0008};
PurePage(unsigned rows=InitialRows,unsigned cols=InitialCols);
PurePage(const PurePage &somePurePage);
virtual ~PurePage();
PurePage &operator=(const PurePage &somePurePage);
bool operator==(const PurePage &somePurePage)const;
unsigned getRows(void);
unsigned getCols(void);
bool getAt(unsigned row,unsigned col,char &charData,Attribute &attribute);
bool getAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer);
bool setAt(unsigned row,unsigned col,char &charData);
bool setAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer);
bool queryState(State state)const;
void setState(State state);
void clearState(State state);
void clearPage(void);
private:
void createPage(unsigned rows,unsigned cols);
bool copyPage(PurePage &purePage);
unsigned mRows;
unsigned mCols;
int mState;
PageData mPageData;
PageAttributes mPageAttributes;
};
inline
PurePage::PurePage(unsigned rows,unsigned cols)
{
createPage(rows,cols);
setState(Created);
}
inline
PurePage::PurePage(const PurePage &somePurePage)
{
*this=somePurePage;
}
inline
PurePage::~PurePage()
{
}
inline
PurePage &PurePage::operator=(const PurePage &somePurePage)
{
copyPage(somePurePage);
return *this;
}
inline
bool PurePage::operator==(const PurePage &somePurePage)const
{
return false;
}
inline
unsigned PurePage::getRows(void)
{
return mRows;
}
inline
unsigned PurePage::getCols(void)
{
return mCols;
}
inline
bool PurePage::getAt(unsigned row,unsigned col,char &charData,Attribute &attribute)
{
return false;
}
inline
bool PurePage::getAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer)
{
return false;
}
inline
bool PurePage::setAt(unsigned row,unsigned col,char &charData)
{
return false;
}
inline
bool PurePage::setAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer)
{
return false;
}
inline
void PurePage::setState(State state)
{
mState|=int(state);
}
inline
void PurePage::clearState(State state)
{
mState|=int(~state);
}
inline
bool PurePage::queryState(State state)const
{
return mState&state;
}
inline
void PurePage::createPage(unsigned rows,unsigned cols)
{
unsigned row;
unsigned col;
mPageData.empty();
mPageAttributes.empty();
for(row=0;row<rows;row++){mPageData.push_back();for(col=0;col<cols;col++)mPageData[row].push_back();}
for(row=0;row<rows;row++){mPageData.push_back();for(col=0;col<cols;col++)mPageAttributes[row].push_back();}
mRows=rows;
mCols=cols;
}
inline
void PurePage::clearPage(void)
{
unsigned row;
for(row=0;row<getRows();row++)
{
::memset(mPageData[row].begin(),' ',mPageData[row].end()-mPageData[row].begin());
::memset(mPageAttributes[row].begin(),0,mPageAttributes[row].end()-mPageAttributes[row].begin());
}
}
inline
bool PurePage::copyPage(PurePage &purePage)
{
unsigned row;
createPage(purePage.getRows(),purePage.getCols());
for(row=0;row<getRows();row++)
{
::memcpy(mPageData[row].begin(),purePage[row].begin(),purePage.getCols());
::memcpy(mPageAttributes[row].begin(),purePage[row].begin(),purePage.getCols());
}
return true;
}
//bool getAt(unsigned row,unsigned col,char &charData,Attribute &attribute);
// bool getAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer);
// bool setAt(unsigned row,unsigned col,char &charData);
// bool setAt(unsigned row,CharRowPointer &charRowPointer,AttributeRowPointer &attributeRowPointer);
#endif

22
test/PAGE1.HTM Normal file
View File

@@ -0,0 +1,22 @@
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<P>&nbsp;</P>
<!-- Insert HTML here -->
<applet
code=Applet1.class
name=Applet1
width=320
height=200 >
<param name=label value="This string was passed from the HTML host.">
<param name=background value="008080">
<param name=foreground value="FFFFFF">
</applet>
</BODY>
</HTML>

98
test/PRINTER.HPP Normal file
View File

@@ -0,0 +1,98 @@
#ifndef _TEST_PRINTER_HPP_
#define _TEST_PRINTER_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
class Printer
{
public:
Printer(void);
Printer(const Printer &somePrinter);
virtual ~Printer();
Printer &operator=(const Printer &somePrinter);
BOOL operator==(const Printer &somePrinter);
const String &printerName(void)const;
void printerName(const String &printerName);
const String &driverName(void)const;
void driverName(const String &driverName);
const String &portName(void)const;
void portName(const String &portName);
private:
String mPrinterName;
String mDriverName;
String mPortName;
};
inline
Printer::Printer(void)
{
}
inline
Printer::Printer(const Printer &somePrinter)
{
*this=somePrinter;
}
inline
Printer::~Printer()
{
}
inline
Printer &Printer::operator=(const Printer &somePrinter)
{
printerName(somePrinter.printerName());
driverName(somePrinter.driverName());
portName(somePrinter.portName());
return *this;
}
inline
BOOL Printer::operator==(const Printer &somePrinter)
{
return (printerName()==somePrinter.printerName()&&
driverName()==somePrinter.driverName()&&
portName()==somePrinter.portName());
}
inline
const String &Printer::printerName(void)const
{
return mPrinterName;
}
inline
void Printer::printerName(const String &printerName)
{
mPrinterName=printerName;
}
inline
const String &Printer::driverName(void)const
{
return mDriverName;
}
inline
void Printer::driverName(const String &driverName)
{
mDriverName=driverName;
}
inline
const String &Printer::portName(void)const
{
return mPortName;
}
inline
void Printer::portName(const String &portName)
{
mPortName=portName;
}
#endif

13
test/PROJECT1.SLN Normal file
View File

@@ -0,0 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 1.00
Project("{66355F20-A65B-11D0-BFB5-00A0C91EBFA0}") = "Project1", "Project1.vjp", "{A191E3D0-2E95-11D3-810B-961FD4A96668}"
EndProject
Global
GlobalSection(LocalDeployment) = postSolution
StartupProject = {A191E3D0-2E95-11D3-810B-961FD4A96668}
EndGlobalSection
GlobalSection(BuildOrder) = postSolution
0 = {A191E3D0-2E95-11D3-810B-961FD4A96668}
EndGlobalSection
GlobalSection(DeploymentRoot) = postSolution
EndGlobalSection
EndGlobal

BIN
test/PROJECT1.SUO Normal file

Binary file not shown.

BIN
test/PROJECT1.VJP Normal file

Binary file not shown.

147
test/Printman.cpp Normal file
View File

@@ -0,0 +1,147 @@
#include <test/printman.hpp>
#include <test/abortdlg.hpp>
#include <common/regkey.hpp>
#include <common/guiwnd.hpp>
Block<VInfo> PrintManager::smVInfoBlock;
BOOL PrintManager::getPrinters(void)
{
String strPrinterKey("System\\CurrentControlSet\\Control\\Print\\Printers");
String strDefaultPrinter;
RegKey cfgKey(RegKey::CurrentConfig);
Printer printer;
String strPrinter;
int enumKey(0);
mPrinters.remove();
if(!cfgKey.openKey(strPrinterKey))return FALSE;
cfgKey.queryValue("Default",strDefaultPrinter);
if(getPrinter(strPrinterKey+String("\\")+strDefaultPrinter,printer))mDefaultPrinter=printer;
while(TRUE)
{
if(!cfgKey.enumKey(enumKey++,strPrinter))break;
if(getPrinter(strPrinterKey+String("\\")+strPrinter,printer))mPrinters.insert(&printer);
}
cfgKey.closeKey();
return TRUE;
}
BOOL PrintManager::getPrinter(String &strPrinterKey,Printer &printer)
{
RegKey mchKey(RegKey::LocalMachine);
String strPrinterNameKey("Name");
String strPrinterDriverKey("Printer Driver");
String strPrinterPortKey("Port");
String strQuery;
if(!mchKey.openKey(strPrinterKey))return FALSE;
mchKey.queryValue(strPrinterNameKey,strQuery);
printer.printerName(strQuery);
mchKey.queryValue(strPrinterDriverKey,strQuery);
printer.driverName(strQuery);
mchKey.queryValue(strPrinterPortKey,strQuery);
printer.portName(strQuery);
mchKey.closeKey();
return TRUE;
}
BOOL PrintManager::openPrinter(const String &strPrinterName,GUIWindow &parentWindow,const String &strPrintDocName)
{
mParentWindow=&parentWindow;
return openPrinter(strPrinterName,strPrintDocName);
}
BOOL PrintManager::openPrinter(const String &strPrinterName,const String &strPrintDocName)
{
Printer printer;
int index;
closePrinter();
if(strPrinterName==mDefaultPrinter.printerName())printer=mDefaultPrinter;
else for(index=0;index<mPrinters.size();index++)if(strPrinterName==mPrinters[index].printerName()){printer=mPrinters[index];break;}
if(index==mPrinters.size())return FALSE;
mPrinterDevice=::CreateDC(0,printer.driverName(),0,0);
mPrinterDevice.disposition(PureDevice::DeleteDC);
if(!mPrinterDevice.isOkay())return FALSE;
smVInfoBlock.insert(&VInfo((DWORD)this,mPrinterDevice));
startDoc(strPrintDocName);
::SetAbortProc(mPrinterDevice,&abortProc);
return TRUE;
}
BOOL PrintManager::startDoc(const String &strPrintDocName)
{
DOCINFO printDocInfo;
::memset(&printDocInfo,0,sizeof(printDocInfo));
printDocInfo.cbSize=sizeof(printDocInfo);
printDocInfo.lpszDocName=(char*)(String&)strPrintDocName;
::StartDoc(mPrinterDevice,&printDocInfo);
isInDoc(TRUE);
createAbortDlg();
return TRUE;
}
BOOL PrintManager::printLines(Block<String> &strLines,Font &pageFont,Point xyPoint)
{
SIZE sizeData;
if(!isInDoc()||!mPrinterDevice.isOkay())return FALSE;
if(isInPage())endPage();
startPage();
mPrinterDevice.select((GDIObj)pageFont,TRUE);
for(int index=0;index<strLines.size();index++)
{
String &strLine=strLines[index];
mPrinterDevice.getTextExtentPoint32(strLine,&sizeData);
mPrinterDevice.textOut(xyPoint.x(),xyPoint.y(),strLine);
xyPoint.y(xyPoint.y()+sizeData.cy+5);
}
endPage();
return TRUE;
}
BOOL PrintManager::createAbortDlg(void)
{
if(!mParentWindow.isOkay())return TRUE;
if(mAbortDlg.isOkay()){mAbortDlg->destroy();mAbortDlg.destroy();}
mAbortDlg=::new AbortDlg;
mAbortDlg.disposition(PointerDisposition::Delete);
mAbortDlg->perform(*mParentWindow);
return TRUE;
}
BOOL CALLBACK PrintManager::abortProc(HDC hDC,int nCode)
{
SmartPointer<PrintManager> printManager;
MSG msg;
if(smVInfoBlock.size())for(int index=0;index<smVInfoBlock.size();index++)
if(smVInfoBlock[index].hDC()==hDC)
{printManager=(PrintManager*)smVInfoBlock[index].baseAddress();break;}
if(!printManager.isOkay())
{
while(::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
else
{
while(printManager->mAbortDlg.isOkay()&&!printManager->mAbortDlg->isDestroyed())
{
printManager->mAbortDlg->yieldTask();
if(printManager->mAbortDlg->isCancelled())return FALSE;
}
while(::PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
{
::TranslateMessage(&msg);
::DispatchMessage(&msg);
}
}
return TRUE;
}

216
test/Printman.hpp Normal file
View File

@@ -0,0 +1,216 @@
#ifndef _TEST_PRINTMANAGER_HPP_
#define _TEST_PRINMANAGER_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_BLOCK_HPP_
#include <common/block.hpp>
#endif
#ifndef _COMMON_PUREDEVICE_HPP_
#include <common/purehdc.hpp>
#endif
#ifndef _COMMON_FONT_HPP_
#include <common/font.hpp>
#endif
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _BONEYARD_PRINTER_HPP_
#include <test/printer.hpp>
#endif
#ifndef _TEST_VINFO_HPP_
#include <test/vinfo.hpp>
#endif
#ifndef _TEST_ABORTDLG_HPP_
#include <test/abortdlg.hpp>
#endif
class GUIWindow;
class PrintManager
{
public:
PrintManager(void);
virtual ~PrintManager();
const String &strDefaultPrinter(void)const;
BOOL openPrinter(const String &strPrinterName,GUIWindow &parentWindow,const String &strPrintDocName=String());
BOOL openPrinter(const String &strPrinterName,const String &strPrintDocName=String());
void closePrinter(void);
PureDevice &printerDevice(void);
BOOL startPage(void);
BOOL endPage(void);
BOOL endDoc(void);
BOOL abortDoc(void);
BOOL printLines(Block<String> &strLines,Font &pageFont,Point xyPoint);
WORD getCount(void)const;
const Printer &getDefaultPrinter(void)const;
BOOL getFirstPrinter(Printer &printer);
BOOL getNextPrinter(Printer &printer);
private:
BOOL getPrinters(void);
BOOL getPrinter(String &strPrinterKey,Printer &printer);
PrintManager(const PrintManager &somePrintmanager);
PrintManager &operator=(const PrintManager &somePrintManager);
BOOL operator==(const PrintManager &somePrintManager);
BOOL isInPage(void)const;
void isInPage(BOOL isInPage);
BOOL isInDoc(void)const;
void isInDoc(BOOL isInDoc);
BOOL startDoc(const String &strPrintDocName);
BOOL createAbortDlg(void);
static BOOL CALLBACK abortProc(HDC hDC,int nCode);
static Block<VInfo> smVInfoBlock;
SmartPointer<GUIWindow> mParentWindow;
SmartPointer<AbortDlg> mAbortDlg;
Block<Printer> mPrinters;
Printer mDefaultPrinter;
PureDevice mPrinterDevice;
WORD mIndexPrinter;
BOOL mIsInDoc;
BOOL mIsInPage;
};
inline
PrintManager::PrintManager(void)
: mIndexPrinter(0), mIsInDoc(FALSE), mIsInPage(FALSE)
{
getPrinters();
}
inline
PrintManager::PrintManager(const PrintManager &somePrintManager)
{ // private implementation
*this=somePrintManager;
}
inline
PrintManager::~PrintManager()
{
closePrinter();
}
inline
PrintManager &PrintManager::operator=(const PrintManager &/*somePrintManager*/)
{ // private implementation
return *this;
}
inline
BOOL PrintManager::operator==(const PrintManager &somePrintManager)
{ // private implementation
return FALSE;
}
inline
WORD PrintManager::getCount(void)const
{
return mPrinters.size();
}
inline
const Printer &PrintManager::getDefaultPrinter(void)const
{
return mDefaultPrinter;
}
inline
BOOL PrintManager::getFirstPrinter(Printer &printer)
{
if(!mPrinters.size())return FALSE;
printer=mPrinters[(mIndexPrinter=0)];
return TRUE;
}
inline
BOOL PrintManager::getNextPrinter(Printer &printer)
{
if(++mIndexPrinter>=mPrinters.size())return FALSE;
printer=mPrinters[mIndexPrinter];
return TRUE;
}
inline
void PrintManager::closePrinter(void)
{
if(isInPage())endPage();
if(isInDoc())endDoc();
mPrinterDevice.destroyDevice();
}
inline
BOOL PrintManager::startPage(void)
{
if(!isInDoc()||!mPrinterDevice.isOkay())return FALSE;
if(isInPage())endPage();
::StartPage(mPrinterDevice);
isInPage(TRUE);
return TRUE;
}
inline
BOOL PrintManager::endPage(void)
{
BOOL returnCode(FALSE);
if(!isInPage()||!isInDoc()||!mPrinterDevice.isOkay())return returnCode;
returnCode=::EndPage(mPrinterDevice)?TRUE:FALSE;
isInPage(FALSE);
return returnCode;
}
inline
BOOL PrintManager::endDoc(void)
{
BOOL returnCode(FALSE);
if(!isInDoc()||!mPrinterDevice.isOkay())return returnCode;
if(isInPage())endPage();
if(mAbortDlg.isOkay()){mAbortDlg->destroy();mAbortDlg.destroy();}
returnCode=::EndDoc(mPrinterDevice)?TRUE:FALSE;
isInDoc(FALSE);
return returnCode;
}
inline
BOOL PrintManager::abortDoc(void)
{
BOOL returnCode(FALSE);
if(!isInDoc()||!mPrinterDevice.isOkay())return returnCode;
returnCode=::AbortDoc(mPrinterDevice)?TRUE:FALSE;
isInPage(FALSE);
return returnCode;
}
inline
PureDevice &PrintManager::printerDevice(void)
{
assert(FALSE!=mPrinterDevice.isOkay());
return mPrinterDevice;
}
inline
BOOL PrintManager::isInDoc(void)const
{
return mIsInDoc;
}
inline
void PrintManager::isInDoc(BOOL isInDoc)
{
mIsInDoc=isInDoc;
}
inline
BOOL PrintManager::isInPage(void)const
{
return mIsInPage;
}
inline
void PrintManager::isInPage(BOOL isInPage)
{
mIsInPage=isInPage;
}
#endif

BIN
test/Proto.class Normal file

Binary file not shown.

109
test/Proto.java Normal file
View File

@@ -0,0 +1,109 @@
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet.*;
import java.net.*;
import java.io.*;
import com.ms.security.*;
public class Proto extends java.applet.Applet
{
private SocketControl mSocketControl;
// private SocketPermission mSocketPermission;
// ConnectionManager mConnectionManager;
String mStrAddress=null;
SocketControl socketControl=null;
private Label mLabelMessage;
private Button mButtonEvaluate;
public void init()
{
mStrAddress=new String("209.139.139.200");
performLayout();
try{if(Class.forName("com.ms.security.PolicyEngine") != null)
{
mLabelMessage.setText("asserting permissions");
PolicyEngine.assertPermission(PermissionID.NETIO);}
}
catch(Throwable cnfe){mLabelMessage.setText("policy assertion failed");return;}
// SecurityManager securityManager=System.getSecurityManager();
// try{securityManager.checkConnect(mStrAddress,1024);}
// catch(SecurityException securityException){mLabelMessage.setText("checkConnect failed");return;}
try{mSocketControl=new SocketControl(mStrAddress,1024);}
catch(SecurityExceptionEx exception)
{
exception.printStackTrace();
mLabelMessage.setText("SecurityExceptionEx");
return;
};
catch(IOException ioException){mLabelMessage.setText("java.io.IOException");return;}
try{mSocketControl.closeSocket();}
catch(IOException ioException){mLabelMessage.setText("java.io.IOException");return;}
mLabelMessage.setText("Success!");
// try{if(Class.forName("com.ms.security.PolicyEngine") != null)PolicyEngine.assertPermission(PermissionID.NETIO);}
// catch(Throwable cnfe){;}
// mSocketPermission=new SocketPermission("192.168.1.2","connect");
// performLayout();
// mLabelMessage.setText("attempting connection...");
// try{SocketControl socketControl=new SocketControl("209.139.139.200",1024);}
// catch(IOException ioException){mLabelMessage.setText("java.io.IOException");}
// try{socketControl.closeSocket();}
// catch(IOException ioException){mLabelMessage.setText("IOException closing socket");}
// public SocketControl(String strHost,int port)throws IOException
// try{mSocketControl=new SocketControl("209.139.139.200",1024);}
// catch(IOException ioException){mLabelMessage.setText("java.io.IOException");}
// catch(SecurityException exception){mLabelMessage.setText("security exception");}
// try{mSocketControl.closeSocket();}
// catch(IOException ioException){;}
/*
if(!mSocketControl.isConnected())mLabelMessage.setText("Connection failed.");
else
{
mLabelMessage.setText("Connected...");
String strLine=new String();
strLine=mSocketControl.readLine();
if(null==strLine)mLabelMessage.setText("nothing received.");
else mLabelMessage.setText(strLine);
try{mSocketControl.closeSocket();}
catch(IOException ioException){mLabelMessage.setText("java.io.Exception");}
}
*/
}
public void update(Graphics graphics)
{
}
public void paint(Graphics graphics)
{
}
public void performLayout()
{
GridBagLayout layout=new GridBagLayout();
GridBagConstraints constraints=new GridBagConstraints();
setFont(new Font("Arial",Font.PLAIN,12));
setLayout(layout);
constraints.gridwidth=1;
constraints.fill=GridBagConstraints.BOTH;
constraints.weightx=0.25;
mButtonEvaluate=new Button("Evaluate");
constraints.gridwidth=GridBagConstraints.REMAINDER;
layout.setConstraints(mButtonEvaluate,constraints);
add(mButtonEvaluate);
mLabelMessage=new Label("Ready.",Label.LEFT);
constraints.gridwidth=GridBagConstraints.REMAINDER;
layout.setConstraints(mLabelMessage,constraints);
add(mLabelMessage);
}
};

13
test/Proto.sln Normal file
View File

@@ -0,0 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 1.00
Project("{66355F20-A65B-11D0-BFB5-00A0C91EBFA0}") = "Proto", "Proto.vjp", "{0781BB40-CEC8-11D3-B501-005004E82B58}"
EndProject
Global
GlobalSection(LocalDeployment) = postSolution
StartupProject = {0781BB40-CEC8-11D3-B501-005004E82B58}
EndGlobalSection
GlobalSection(BuildOrder) = postSolution
0 = {0781BB40-CEC8-11D3-B501-005004E82B58}
EndGlobalSection
GlobalSection(DeploymentRoot) = postSolution
EndGlobalSection
EndGlobal

BIN
test/Proto.suo Normal file

Binary file not shown.

BIN
test/Proto.vjp Normal file

Binary file not shown.

83
test/REGS.RC Normal file
View File

@@ -0,0 +1,83 @@
#define DEBUG_FLAGS_DIRECTION 121
#define DEBUG_FLAGS_INTERRUPT 122
#define DEBUG_CONTINUE 123
#define DEBUG_DEBUGSTRING 124
#define DEBUG_CS 125
#define DEBUG_SS 126
#define DEBUG_CODE 114
#define DEBUG_FLAGS_A 120
#define DEBUG_FLAGS_PARITY 119
#define DEBUG_FLAGS_OVERFLOW 118
#define DEBUG_FLAGS_SIGN 117
#define DEBUG_FLAGS_ZERO 116
#define DEBUG_FLAGS_CARRY 115
#define DEBUG_GS 112
#define DEBUG_FS 111
#define DEBUG_ES 110
#define DEBUG_DS 109
#define DEBUG_EIP 113
#define DEBUG_EBP 108
#define DEBUG_ESP 107
#define DEBUG_EDI 106
#define DEBUG_EDX 104
#define DEBUG_ECX 103
#define DEBUG_EBX 102
#define DEBUG_ESI 105
#define DEBUG_EAX 101
DEBUG DIALOG 6, 15, 336, 145
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "DEBUG"
FONT 6, "Helv"
{
LTEXT "EAX:", -1, 2, 9, 19, 8
EDITTEXT DEBUG_EAX, 22, 7, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
LTEXT "EBX:", -1, 72, 9, 17, 8
LTEXT "ECX:", -1, 143, 9, 16, 8
LTEXT "EDX:", -1, 213, 9, 16, 8
LTEXT "ESI:", -1, 2, 23, 19, 8
EDITTEXT DEBUG_EBX, 92, 7, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_ECX, 162, 7, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_EDX, 231, 7, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_ESI, 22, 21, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_EDI, 92, 21, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
LTEXT "EDI:", -1, 72, 23, 14, 8
EDITTEXT DEBUG_ESP, 162, 21, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_EBP, 231, 20, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
LTEXT "ESP:", -1, 143, 23, 16, 8
LTEXT "EBP:", -1, 213, 23, 17, 8
LTEXT "DS:", -1, 282, 10, 13, 8
LTEXT "ES:", -1, 282, 22, 12, 8
LTEXT "FS:", -1, 282, 35, 13, 8
LTEXT "GS:", -1, 282, 48, 13, 8
EDITTEXT DEBUG_DS, 295, 7, 26, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_ES, 295, 20, 26, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_FS, 295, 33, 26, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_GS, 295, 46, 26, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_EIP, 231, 33, 48, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
LTEXT "EIP:", -1, 213, 35, 13, 8
LTEXT "CF:", -1, 232, 52, 12, 8
LTEXT "ZF:", -1, 232, 65, 12, 8
LTEXT "SF:", -1, 232, 78, 12, 8
LTEXT "OV:", -1, 232, 92, 12, 8
LTEXT "PF:", -1, 257, 52, 12, 8
LTEXT "AF:", -1, 257, 65, 12, 8
LTEXT "IF:", -1, 257, 92, 12, 8
LTEXT "DF:", -1, 257, 78, 12, 8
LISTBOX DEBUG_CODE, 3, 49, 225, 72, LBS_NOTIFY | WS_BORDER | LBS_NOINTEGRALHEIGHT | WS_BORDER | WS_HSCROLL
EDITTEXT DEBUG_FLAGS_CARRY, 244, 51, 10, 12, WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_FLAGS_ZERO, 244, 64, 10, 12, WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_FLAGS_SIGN, 244, 77, 10, 12, WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_FLAGS_OVERFLOW, 244, 90, 10, 12, WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_FLAGS_PARITY, 269, 51, 10, 12, WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_FLAGS_A, 269, 64, 10, 12, WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_FLAGS_DIRECTION, 269, 77, 10, 12, WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_FLAGS_INTERRUPT, 269, 90, 10, 12, WS_BORDER | WS_TABSTOP
EDITTEXT DEBUG_DEBUGSTRING, 4, 128, 326, 13, WS_BORDER | WS_TABSTOP
PUSHBUTTON "Continue", DEBUG_CONTINUE, 283, 88, 50, 14, WS_DISABLED | WS_TABSTOP
EDITTEXT DEBUG_CS, 295, 59, 26, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
LTEXT "CS:", -1, 282, 62, 13, 8
EDITTEXT DEBUG_SS, 295, 72, 26, 12, ES_MULTILINE | WS_BORDER | WS_TABSTOP
LTEXT "SS:", -1, 282, 74, 13, 8
}

BIN
test/REGS.RWS Normal file

Binary file not shown.

BIN
test/RISKS.BMP Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
test/RISKS.~BM Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

102
test/ReadMe.txt Normal file
View File

@@ -0,0 +1,102 @@
========================================================================
MICROSOFT FOUNDATION CLASS LIBRARY : test
========================================================================
AppWizard has created this test application for you. This application
not only demonstrates the basics of using the Microsoft Foundation classes
but is also a starting point for writing your application.
This file contains a summary of what you will find in each of the files that
make up your test application.
test.h
This is the main header file for the application. It includes other
project specific headers (including Resource.h) and declares the
CTestApp application class.
test.cpp
This is the main application source file that contains the application
class CTestApp.
test.rc
This is a listing of all of the Microsoft Windows resources that the
program uses. It includes the icons, bitmaps, and cursors that are stored
in the RES subdirectory. This file can be directly edited in Microsoft
Developer Studio.
res\test.ico
This is an icon file, which is used as the application's icon. This
icon is included by the main resource file test.rc.
res\test.rc2
This file contains resources that are not edited by Microsoft
Developer Studio. You should place all resources not
editable by the resource editor in this file.
test.clw
This file contains information used by ClassWizard to edit existing
classes or add new classes. ClassWizard also uses this file to store
information needed to create and edit message maps and dialog data
maps and to create prototype member functions.
/////////////////////////////////////////////////////////////////////////////
For the main frame window:
MainFrm.h, MainFrm.cpp
These files contain the frame class CMainFrame, which is derived from
CMDIFrameWnd and controls all MDI frame features.
res\Toolbar.bmp
This bitmap file is used to create tiled images for the toolbar.
The initial toolbar and status bar are constructed in the
CMainFrame class. Edit this toolbar bitmap along with the
array in MainFrm.cpp to add more toolbar buttons.
/////////////////////////////////////////////////////////////////////////////
AppWizard creates one document type and one view:
testDoc.h, testDoc.cpp - the document
These files contain your CTestDoc class. Edit these files to
add your special document data and to implement file saving and loading
(via CTestDoc::Serialize).
testView.h, testView.cpp - the view of the document
These files contain your CTestView class.
CTestView objects are used to view CTestDoc objects.
res\testDoc.ico
This is an icon file, which is used as the icon for MDI child windows
for the CTestDoc class. This icon is included by the main
resource file test.rc.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named test.pch and a precompiled types file named StdAfx.obj.
Resource.h
This is the standard header file, which defines new resource IDs.
Microsoft Developer Studio reads and updates this file.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
If your application uses MFC in a shared DLL, and your application is
in a language other than the operating system's current language, you
will need to copy the corresponding localized resources MFC40XXX.DLL
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
For example, MFC40DEU.DLL contains resources translated to German.) If you
don't do this, some of the UI elements of your application will remain in the
language of the operating system.
/////////////////////////////////////////////////////////////////////////////

19
test/Resource.h Normal file
View File

@@ -0,0 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by TEST.RC
//
#define IDR_MAINFRAME 128
#define IDR_TESTTYPE 129
#define IDD_ABOUTBOX 100
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 32771
#endif
#endif

265
test/SCRAPS.TXT Normal file
View File

@@ -0,0 +1,265 @@
HostEnt hostEntry;
WSASystem wsaSystem;
Socket socket;
String strHost("li.net");
winConsole.writeLine("Initializing sockets...");
if(!wsaSystem.isInitialized()){winConsole.writeLine("Cannot initialize sockets.");winConsole.read();return FALSE;}
winConsole.writeLine("Socket initialization complete.");
if(!wsaSystem.description().isNull())winConsole.writeLine(String("<")+wsaSystem.description()+String(">"));
winConsole.writeLine("Opening socket...");
socket.openSocket();
if(!socket.isOkay()){winConsole.writeLine("Cannot open socket.");winConsole.read();return FALSE;}
winConsole.writeLine("Open complete.");
winConsole.writeLine(String("Trying ")+strHost+String(" ...."));
InternetAddress internetAddress(strHost);
if(!internetAddress.isZero()){if(!hostEntry.hostByAddress(internetAddress)){winConsole.writeLine(String("no DNS entry for ")+strHost);winConsole.read();return FALSE;}}
else if(!hostEntry.hostByName(strHost)){winConsole.writeLine(String("no DNS entry for ")+strHost);winConsole.read();return FALSE;}
winConsole.writeLine(String("connect...")+String("'")+hostEntry.hostName()+String("' (")+(String)(hostEntry.addresses())[0]+String(")"));
socket.closeSocket();
winConsole.writeLine("Internet is available on this machine. :) Later Peach.");
// else if(!hostEntry.hostByName(hostName)){message(String("no DNS entry for ")+hostName);return FALSE;}
// message(String("connect...")+String("'")+hostEntry.hostName()+String("' (")+(String)(hostEntry.addresses())[0]+String(")"));
// INETSocketAddress::internetAddress((hostEntry.addresses())[0]);
// if(!serverEntry.serviceByName("ftp","tcp")){message("cannot determine port number for ftp daemon.");return FALSE;}
// if(!mFTPControl.openSocket()){message("unable to create socket.");return FALSE;}
// INETSocketAddress::family(PF_INET);
// INETSocketAddress::port(serverEntry.port());
// if(!mFTPControl.connect((INETSocketAddress&)*this)){message("unable to connect to ftp daemon");return FALSE;}
// if(!receive(mAckConnectionResponseStrings))return FALSE;
// mFTPControl.getSocketName((INETSocketAddress&)*this);
// return mFTPControl.isConnected();
// InternetAddress internetAddress(void)const;
// void internetAddress(const InternetAddress &someInternetAddress);
winConsole.read();
#include <common/process.hpp>
#include <common/console.hpp>
#include <socket/socket.hpp>
#include <socket/hostent.hpp>
#include <socket/wsadata.hpp>
#include <socket/inaddr.hpp>
#include <socket/intsaddr.hpp>
int index;
BYTE currByte;
BYTE lastByte;
BYTE repCount;
bool reset;
index=0;
reset=true;
mInputCount=0;
mOutputCount=0;
while(index<inData.size())
{
currByte=inData[index];
mInputCount++;
if(reset)
{
lastByte=currByte;
repCount=1;
reset=false;
}
else
{
if(lastByte==currByte)
{
if(repCount==MaxRep)
{
output(repCount,lastByte);
reset=true;
}
else repCount++;
}
else
{
reset=true;
output(repCount,lastByte);
}
}
index++;
}
#include <common/gdata.hpp>
#include <common/openfile.hpp>
#include <common/console.hpp>
class RLECompress
{
public:
RLECompress(void);
virtual ~RLECompress();
bool compress(GlobalData<unsigned char> &inData,GlobalData<unsigned char> &outData);
bool decompress(GlobalData<unsigned char> &inData,GlobalData<unsigned char> &outData);
float getCompressionRatio(void)const;
unsigned getOutputCount(void)const;
unsigned getInputCount(void)const;
private:
enum{MaxRep=128};
unsigned compress(unsigned char *pInData,unsigned char *pOutData,unsigned inLength,bool emit);
void output(unsigned char repCount,unsigned char charData,unsigned char *pOutData,unsigned &outIndex,bool emit);
unsigned mOutputCount;
unsigned mInputCount;
};
inline
RLECompress::RLECompress(void)
{
}
inline
RLECompress::~RLECompress()
{
}
inline
bool RLECompress::compress(GlobalData<BYTE> &inData,GlobalData<BYTE> &outData)
{
unsigned requiredLength;
unsigned char charData;
requiredLength=compress(&inData[0],&charData,inData.size(),false);
outData.size(requiredLength+4);
*((unsigned*)&outData[0])=mInputCount;
compress(&inData[0],&outData[4],inData.size(),true);
return true;
}
inline
unsigned RLECompress::compress(unsigned char *pInData,unsigned char *pOutData,unsigned inLength,bool emit)
{
unsigned char currByte;
unsigned char lastByte;
unsigned char repCount;
unsigned srcIndex;
unsigned dstIndex;
bool reset;
srcIndex=0;
dstIndex=0;
reset=true;
mInputCount=0;
mOutputCount=0;
while(srcIndex<inLength)
{
currByte=pInData[srcIndex];
mInputCount++;
if(reset)
{
lastByte=currByte;
repCount=1;
reset=false;
}
else
{
if(lastByte==currByte)
{
if(repCount==MaxRep)
{
output(repCount,lastByte,pOutData,dstIndex,emit);
reset=true;
}
else repCount++;
}
else
{
reset=true;
output(repCount,lastByte,pOutData,dstIndex,emit);
}
}
srcIndex++;
}
return mOutputCount;
}
inline
void RLECompress::output(unsigned char repCount,unsigned char charData,unsigned char *pOutData,unsigned &outIndex,bool emit)
{
mOutputCount+=2;
if(!emit)return;
pOutData[outIndex++]=repCount;
pOutData[outIndex++]=charData;
}
inline
float RLECompress::getCompressionRatio(void)const
{
if(!mInputCount)return 0.00;
return 100.00-(((float)mOutputCount/(float)mInputCount)*100.00);
}
inline
bool RLECompress::decompress(GlobalData<BYTE> &inData,GlobalData<BYTE> &outData)
{
return true;
}
inline
unsigned RLECompress::getOutputCount(void)const
{
return mOutputCount;
}
inline
unsigned RLECompress::getInputCount(void)const
{
return mInputCount;
}
//int PASCAL WinMain(HINSTANCE /*hInstance*/,HINSTANCE /*hPrevInstance*/,LPSTR lpszCmdLine,int /*nCmdShow*/)
int main(int argc,char **argv)
{
FileHandle openFile;
GlobalData<BYTE> inData;
GlobalData<BYTE> outData;
RLECompress rleCompress;
String strMessage;
String strPathFileName;
Console winConsole;
winConsole.getConsoleScreenBufferInfo();
if(1==argc)return 0;
// if(!lpszCmdLine)return 0;
// strPathFileName=lpszCmdLine;
strPathFileName=argv[1];
if(!openFile.open(strPathFileName))
{
winConsole.writeLine(String("can't open '")+strPathFileName+String("'"));
winConsole.read();
return 0;
}
inData.size(openFile.size());
openFile.read(&inData[0],inData.size());
rleCompress.compress(inData,outData);
::sprintf(strMessage,"compression ratio:%lf",rleCompress.getCompressionRatio());
winConsole.writeLine(strMessage);
::sprintf(strMessage,"input length:%d",rleCompress.getInputCount());
winConsole.writeLine(strMessage);
::sprintf(strMessage,"output length:%d",rleCompress.getOutputCount());
winConsole.writeLine(strMessage);
winConsole.read();
return 0;
}

147
test/SPLASH.CPP Normal file
View File

@@ -0,0 +1,147 @@
#include <test/splash.hpp>
#include <common/resbmp.hpp>
#include <common/dib.hpp>
#include <common/bitmap.hpp>
char SplashScreen::szClassName[]="SplashScreen";
SplashScreen::SplashScreen(const String &strBitmap,const String &strCaption,BOOL useTimer)
: mBitmapName(strBitmap), mStrCaption(strCaption), mUseTimer(useTimer),
mTextFont("Times New Roman",12,Font::PitchVariable|Font::FamilySwiss,Font::WeightBold)
{
mResBitmap=new ResBitmap(mBitmapName);
mResBitmap.disposition(PointerDisposition::Delete);
mCreateHandler.setCallback(this,&SplashScreen::createHandler);
mPaintHandler.setCallback(this,&SplashScreen::paintHandler);
mDestroyHandler.setCallback(this,&SplashScreen::destroyHandler);
mPaletteChangedHandler.setCallback(this,&SplashScreen::paletteChangedHandler);
mSetFocusHandler.setCallback(this,&SplashScreen::setFocusHandler);
mTimerHandler.setCallback(this,&SplashScreen::timerHandler);
insertHandler(VectorHandler::CreateHandler,&mCreateHandler);
insertHandler(VectorHandler::PaintHandler,&mPaintHandler);
insertHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
insertHandler(VectorHandler::PaletteChangedHandler,&mPaletteChangedHandler);
insertHandler(VectorHandler::SetFocusHandler,&mSetFocusHandler);
insertHandler(VectorHandler::TimerHandler,&mTimerHandler);
registerClass();
}
SplashScreen::SplashScreen(const SplashScreen &someSplashScreen)
{ // private implementation
}
SplashScreen::~SplashScreen()
{
removeHandler(VectorHandler::CreateHandler,&mCreateHandler);
removeHandler(VectorHandler::PaintHandler,&mPaintHandler);
removeHandler(VectorHandler::DestroyHandler,&mDestroyHandler);
removeHandler(VectorHandler::PaletteChangedHandler,&mPaletteChangedHandler);
removeHandler(VectorHandler::SetFocusHandler,&mSetFocusHandler);
removeHandler(VectorHandler::TimerHandler,&mTimerHandler);
}
void SplashScreen::registerClass(void)
{
HINSTANCE hInstance(processInstance());
WNDCLASS wndClass;
if(::GetClassInfo(hInstance,szClassName,(WNDCLASS FAR*)&wndClass))return;
wndClass.style =CS_HREDRAW|CS_VREDRAW|CS_DBLCLKS|CS_OWNDC;
wndClass.lpfnWndProc =(WNDPROC)Window::WndProc;
wndClass.cbClsExtra =0;
wndClass.cbWndExtra =sizeof(SplashScreen*);
wndClass.hInstance =hInstance;
wndClass.hIcon =::LoadIcon(NULL,IDI_APPLICATION);
wndClass.hCursor =::LoadCursor(NULL,IDC_ARROW);
wndClass.hbrBackground =(HBRUSH)::GetStockObject(NULL_BRUSH);
wndClass.lpszMenuName =0;
wndClass.lpszClassName =szClassName;
::RegisterClass(&wndClass);
assert(0!=::GetClassInfo(hInstance,szClassName,(WNDCLASS FAR*)&wndClass));
}
SplashScreen &SplashScreen::operator=(const SplashScreen &someSplashScreen)
{ // private implementation
return *this;
}
BOOL SplashScreen::perform(Rect initRect)
{
UINT style(0);
if(CW_USEDEFAULT==initRect.right())initRect.right(mResBitmap->width());
if(CW_USEDEFAULT==initRect.bottom())initRect.bottom(mResBitmap->height());
if(useTimer())
{
PureDevice pureDevice;
pureDevice.screenDevice();
initRect.left((pureDevice.horizontalResolution()-mResBitmap->width())/2);
initRect.top((pureDevice.verticalResolution()-mResBitmap->height())/2);
style=WS_POPUP|WS_CLIPSIBLINGS|0x04|WS_DLGFRAME;
}
else style=WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_BORDER|WS_DLGFRAME|0x04|WS_CLIPSIBLINGS;
createWindow(WS_EX_CONTROLPARENT,szClassName,useTimer()?(char*)0:(char*)mStrCaption,style,initRect,NULL,NULL,processInstance(),(LPSTR)this); // WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_BORDER|WS_DLGFRAME|0x04|WS_CLIPSIBLINGS
show(SW_SHOW);
update();
return messageLoop();
}
CallbackData::ReturnType SplashScreen::destroyHandler(CallbackData &someCallbackData)
{
PureDevice pureDevice(*this);
((PurePalette&)*mDIBitmap).usePalette(pureDevice,FALSE);
postQuitMessage(onDestroy());
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType SplashScreen::createHandler(CallbackData &someCallbackData)
{
mPureDevice=new PureDevice(*this);
mPureDevice.disposition(PointerDisposition::Delete);
mDIBitmap=new DIBitmap(*mPureDevice,mResBitmap->width(),mResBitmap->height(),*mResBitmap);
mDIBitmap.disposition(PointerDisposition::Delete);
if(useTimer())setTimer(TimerID,TimeOut);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType SplashScreen::timerHandler(CallbackData &someCallbackData)
{
killTimer(TimerID);
postMessage(*this,WM_CLOSE,0,0L);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType SplashScreen::paletteChangedHandler(CallbackData &someCallbackData)
{
if(!mDIBitmap.isOkay()||((HWND)*this==(HWND)someCallbackData.wParam()))return (CallbackData::ReturnType)FALSE;
PureDevice pureDevice(*this);
((PurePalette&)*mDIBitmap).usePalette(pureDevice,TRUE);
update();
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType SplashScreen::setFocusHandler(CallbackData &/*someCallbackData*/)
{
if(!mDIBitmap.isOkay())return (CallbackData::ReturnType)FALSE;
PureDevice pureDevice(*this);
((PurePalette&)*mDIBitmap).usePalette(pureDevice,TRUE);
return (CallbackData::ReturnType)FALSE;
}
CallbackData::ReturnType SplashScreen::paintHandler(CallbackData &someCallbackData)
{
if(!mResBitmap.isOkay())return (CallbackData::ReturnType)FALSE;
PaintInformation *pPaintInfo=(PaintInformation*)someCallbackData.lParam();
PureDevice &pureDevice=(PureDevice&)*pPaintInfo;
mDIBitmap->copyBits(mResBitmap->ptrData(),mResBitmap->imageExtent());
mDIBitmap->stretchBlt(pureDevice,Rect(0,0,width(),height()));
return (CallbackData::ReturnType)FALSE;
}
// virtuals
int SplashScreen::onDestroy(void)
{
return 0;
}

67
test/SPLASH.HPP Normal file
View File

@@ -0,0 +1,67 @@
#ifndef _RISK_SPLASHSCREEN_HPP_
#define _RISK_SPLASHSCREEN_HPP_
#ifndef _COMMON_SMARTPOINTER_HPP_
#include <common/pointer.hpp>
#endif
#ifndef _COMMON_STRING_HPP_
#include <common/string.hpp>
#endif
#ifndef _COMMON_WINDOW_HPP_
#include <common/window.hpp>
#endif
#ifndef _COMMON_RECTANGLE_HPP_
#include <common/rect.hpp>
#endif
#ifndef _COMMON_FONT_HPP_
#include <common/font.hpp>
#endif
class ResBitmap;
class DIBitmap;
class SplashScreen : public Window
{
public:
SplashScreen(const String &strBitmap,const String &strCaption,BOOL useTimer);
virtual ~SplashScreen();
BOOL perform(Rect initRect=Rect(CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT));
protected:
virtual int onDestroy(void);
private:
enum {TimerID=0,TimeOut=5000};
SplashScreen(const SplashScreen &someSplashScreen);
SplashScreen &operator=(const SplashScreen &someSplashScreen);
CallbackData::ReturnType createHandler(CallbackData &someCallbackData);
CallbackData::ReturnType paintHandler(CallbackData &someCallbackData);
CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
CallbackData::ReturnType paletteChangedHandler(CallbackData &someCallbackData);
CallbackData::ReturnType setFocusHandler(CallbackData &someCallbackData);
CallbackData::ReturnType timerHandler(CallbackData &someCallbackData);
void registerClass(void);
BOOL useTimer(void)const;
Callback<SplashScreen> mPaintHandler;
Callback<SplashScreen> mCreateHandler;
Callback<SplashScreen> mDestroyHandler;
Callback<SplashScreen> mPaletteChangedHandler;
Callback<SplashScreen> mSetFocusHandler;
Callback<SplashScreen> mTimerHandler;
SmartPointer<ResBitmap> mResBitmap;
SmartPointer<DIBitmap> mDIBitmap;
SmartPointer<PureDevice> mPureDevice;
String mBitmapName;
String mStrCaption;
String mInstallLine;
BOOL mUseTimer;
Font mTextFont;
static char szClassName[];
};
inline
BOOL SplashScreen::useTimer(void)const
{
return mUseTimer;
}
#endif

27
test/STDTMPL.CPP Normal file
View File

@@ -0,0 +1,27 @@
#define _EXPAND_VECTOR_TEMPLATES_
#define _EXPAND_BLOCK_TEMPLATES_
#include <common/point.hpp>
#include <common/rgbcolor.hpp>
#include <common/pvector.hpp>
#include <common/pvector.tpp>
#include <common/callback.hpp>
#include <common/callback.tpp>
#include <common/block.hpp>
#include <common/block.tpp>
#include <common/qsort.hpp>
#include <common/qsort.tpp>
#include <common/binsrch.hpp>
#include <common/binsrch.tpp>
#include <common/gdata.hpp>
#include <common/gdata.tpp>
#include <common/string.hpp>
#include <common/filemap.hpp>
#include <image/pureimp.hpp>
typedef PureVector<Point> a;
typedef PureVector<RGBColor> b;
typedef Block<String> c;
typedef GlobalData<BYTE> e;
typedef QuickSort<PureImport> f;
typedef BinarySearch<PureImport> g;

Binary file not shown.

View File

@@ -0,0 +1,18 @@
import java.net.*;
import java.io.*;
public class ServerSocketControl extends ServerSocket
{
public ServerSocketControl(int port)throws IOException
{
super(port);
}
public void accept(SocketControl socketControl)throws IOException
{
implAccept(socketControl);
}
}

BIN
test/SocketControl.class Normal file

Binary file not shown.

202
test/SocketControl.java Normal file
View File

@@ -0,0 +1,202 @@
import java.net.*;
import java.io.*;
public class SocketControl extends Socket
{
public final int OkResult=220;
public final int ErrorResult=500;
private InputStream mInputStream=null;
private OutputStream mOutputStream=null;
private boolean mIsConnected=false;
public SocketControl()
{
}
public SocketControl(String strHost,int port)throws IOException
{
super(strHost,port);
// try{mInputStream=getInputStream();}
// catch(IOException exception){close();return;}
// try{mOutputStream=getOutputStream();}
// catch(IOException exception){close();return;}
isConnected(true);
}
public SocketControl(InetAddress inetAddress,int port)throws IOException
{
super(inetAddress,port);
try{mInputStream=getInputStream();}
catch(IOException exception){close();return;}
try{mOutputStream=getOutputStream();}
catch(IOException exception){close();return;}
isConnected(true);
}
public void closeSocket()throws IOException
{
isConnected(false);
close();
}
public boolean isConnected()
{
return mIsConnected;
}
private void isConnected(boolean isConnected)
{
mIsConnected=isConnected;
}
public String readLine()
{
byte streamByte[];
String strLine=new String();
if(!isConnected())return strLine;
strLine=new String();
while(true)
{
streamByte=new byte[1];
try{mInputStream.read(streamByte);}
catch(IOException exception){break;}
if(13==streamByte[0])continue;
else if(10==streamByte[0])break;
strLine+=new String(streamByte);
}
return strLine;
}
public boolean writeLine(String strLine)
{
if(!isConnected()||0==strLine.length())return false;
strLine+=new String("\r\n");
byte streamData[]=strLine.getBytes();
try{mOutputStream.write(streamData);}
catch(IOException exception){return false;}
return true;
}
public int getResultCode(String strLine)
{
if(0==strLine.length())return 0;
String strResult=new String();
int strIndex=0;
while(true)
{
if(strIndex>=3)break;
if(' '==strLine.charAt(strIndex))break;
strResult+=strLine.charAt(strIndex);
strIndex++;
}
if(0==strResult.length())return 0;
return Integer.parseInt(strResult);
}
public String getResult(String strLine)
{
String strResult=new String();
int strIndex=0;
int strLength=strLine.length();
if(0==strLength)return strResult;
while(' '!=strLine.charAt(strIndex)&&strIndex<strLength)strIndex++;
strIndex++;
if(strIndex>=strLength)return strResult;
while(strIndex<strLength)
{
strResult+=strLine.charAt(strIndex);
strIndex++;
}
return strResult;
}
public boolean receive(StringArray receiveStrings,StringArray responseStrings)
{
boolean isInMultiLine=false;
boolean returnCode=true;
String seriesItem=new String();
String stringData=new String();
receiveStrings.clear();
if(!isConnected())return false;
while(true)
{
stringData=readLine();
if(0==stringData.length())break;
if(0==receiveStrings.size())
{
seriesItem=stringData.substring(0,3);
if(!isInResponse(seriesItem,responseStrings))
{
returnCode=false;
receiveStrings.insert(stringData);
break;
}
if('-'==stringData.charAt(3))isInMultiLine=true;
}
if(0!=receiveStrings.size()&&isInMultiLine&&'-'!=stringData.charAt(3)&&stringData.substring(0,3)==seriesItem)
{
receiveStrings.insert(stringData);
break;
}
receiveStrings.insert(stringData);
if(!isInMultiLine)break;
}
return returnCode;
}
public boolean receive(StringArray receiveStrings)
{
boolean isInMultiLine=false;
boolean returnCode=false;
String seriesItem=new String();
String stringData=new String();
receiveStrings.clear();
if(!isConnected())return false;
while(true)
{
stringData=readLine();
if(0==stringData.length())break;
if(0==receiveStrings.size())
{
seriesItem=stringData.substring(0,3);
if('-'==stringData.charAt(3))isInMultiLine=true;
}
if(0!=receiveStrings.size()&&isInMultiLine&&'-'!=stringData.charAt(3)&&stringData.substring(0,3).equals(seriesItem))
{
receiveStrings.insert(stringData);
break;
}
receiveStrings.insert(stringData);
if(!isInMultiLine)break;
}
if(0!=receiveStrings.size())return true;
return false;
}
public boolean isInResponse(String responseString,StringArray responseStrings)
{
if(0==responseString.length())return false;
for(int index=0;index<responseStrings.size();index++)
{
if(responseString.equals(responseStrings.getAt(index)))return true;
}
return false;
}
public boolean accept(int port)throws IOException
{
ServerSocketControl serverSocketControl=null;
try{serverSocketControl=new ServerSocketControl(port);}
catch(IOException exception){return false;}
try{serverSocketControl.accept(this);}
catch(IOException exception){return false;}
try{mInputStream=getInputStream();}
catch(IOException exception)
{
try{closeSocket();}
finally{return false;}
}
try{mOutputStream=getOutputStream();}
catch(IOException exception)
{
try{closeSocket();}
finally{return false;}
}
isConnected(true);
return isConnected();
}
}

6
test/StdAfx.cpp Normal file
View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// test.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

16
test/StdAfx.h Normal file
View File

@@ -0,0 +1,16 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT

BIN
test/StringArray.class Normal file

Binary file not shown.

67
test/StringArray.java Normal file
View File

@@ -0,0 +1,67 @@
import java.lang.ArrayIndexOutOfBoundsException;
class StringArray
{
private final int BlockSize=16;
private int mGrowBy=BlockSize;
private int mActualItemCount=0;
private int mVirtualItemCount=mGrowBy;
private String mStringArray[]=new String[mGrowBy];
public String getAt(int arrayIndex)throws ArrayIndexOutOfBoundsException
{
if(arrayIndex>=size())throw new ArrayIndexOutOfBoundsException();
return mStringArray[arrayIndex];
}
public void setAt(String strItem,int arrayIndex)throws ArrayIndexOutOfBoundsException
{
if(arrayIndex>=size())throw new ArrayIndexOutOfBoundsException();
mStringArray[arrayIndex]=strItem;
}
public boolean insert(String strItem)
{
guarantee(size()+1);
mStringArray[size()]=strItem;
size(size()+1);
return true;
}
public void guarantee(int requiredSize)
{
if(virtualSize()>=requiredSize)return;
String tmpArray[]=new String[virtualSize()+growBy()];
for(int index=0;index<virtualSize();index++)tmpArray[index]=mStringArray[index];
mStringArray=new String[virtualSize()+growBy()];
virtualSize(virtualSize()+growBy());
for(int index=0;index<virtualSize();index++)mStringArray[index]=tmpArray[index];
}
public int size()
{
return mActualItemCount;
}
private void size(int actualItemCount)
{
mActualItemCount=actualItemCount;
}
private int virtualSize()
{
return mVirtualItemCount;
}
private void virtualSize(int virtualSize)
{
mVirtualItemCount=virtualSize;
}
public int growBy()
{
return mGrowBy;
}
public void growBy(int growBy)
{
mGrowBy=growBy;
}
public void clear()
{
mStringArray=new String[growBy()];
size(0);
virtualSize(growBy());
}
}

102
test/TEST.001 Normal file
View File

@@ -0,0 +1,102 @@
# Microsoft Developer Studio Project File - Name="test" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=test - 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 "test.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 "test.mak" CFG="test - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "test - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "test - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "test - 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 Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "test - 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 /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /Zp1 /MTd /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:windows /machine:I386 /pdbtype:sept
# SUBTRACT LINK32 /debug
!ENDIF
# Begin Target
# Name "test - Win32 Release"
# Name "test - Win32 Debug"
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# Begin Source File
SOURCE=..\..\work\exe\mscommon.lib
# End Source File
# Begin Source File
SOURCE=..\..\work\exe\mssocket.lib
# End Source File
# End Target
# End Project

128
test/TEST.002 Normal file
View File

@@ -0,0 +1,128 @@
# Microsoft Developer Studio Project File - Name="test" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=test - 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 "test.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 "test.mak" CFG="test - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "test - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "test - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "test - 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 Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "test - 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 "msvcobj"
# PROP Intermediate_Dir "msvcobj"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /Zp1 /MTd /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# 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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "test - Win32 Release"
# Name "test - Win32 Debug"
# Begin Source File
SOURCE=..\printman\Abortdlg.cpp
# End Source File
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# Begin Source File
SOURCE=.\Mainwnd.cpp
# End Source File
# Begin Source File
SOURCE=..\..\work\exe\mscommon.lib
# End Source File
# Begin Source File
SOURCE=..\..\work\exe\msdialog.lib
# End Source File
# Begin Source File
SOURCE=..\printman\pickdlg.cpp
# End Source File
# Begin Source File
SOURCE=..\printman\Printman.cpp
# End Source File
# Begin Source File
SOURCE=.\test.rc
!IF "$(CFG)" == "test - Win32 Release"
!ELSEIF "$(CFG)" == "test - Win32 Debug"
!ENDIF
# End Source File
# End Target
# End Project

34
test/TEST.PLG Normal file
View File

@@ -0,0 +1,34 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: test - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\TEMP\RSP4C.tmp" with contents
[
/nologo /Zp1 /MTd /GX /ZI /Od /I "\work" /I "\parts" /I "\parts\sgi_stl" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /Fp"msvcobj/test.pch" /YX /Fo"msvcobj/" /Fd"msvcobj/" /FD /I /work" /I /parts" /c
"E:\work\TEST\main.cpp"
]
Creating command line "cl.exe @C:\TEMP\RSP4C.tmp"
Creating temporary file "C:\TEMP\RSP4D.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib wsock32.lib ole32.lib /nologo /subsystem:console /incremental:no /pdb:"msvcobj/test.pdb" /debug /machine:I386 /out:"msvcobj/test.exe" /pdbtype:sept
.\msvcobj\main.obj
..\exe\mscommon.lib
]
Creating command line "link.exe @C:\TEMP\RSP4D.tmp"
<h3>Output Window</h3>
Compiling...
main.cpp
Linking...
LINK : warning LNK4075: ignoring /EDITANDCONTINUE due to /INCREMENTAL:NO specification
<h3>Results</h3>
test.exe - 0 error(s), 1 warning(s)
</pre>
</body>
</html>

BIN
test/TEST.RES Normal file

Binary file not shown.

BIN
test/TEST.RWS Normal file

Binary file not shown.

26
test/TEST.~RC Normal file
View File

@@ -0,0 +1,26 @@
#include <windows.h>
#include <test/test.h>
RISK BITMAP "risks.bmp"
mainMenu MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "File &Open...", MAINMENU_FILEOPEN
MENUITEM "File &Print...", MAINMENU_FILEPRINT
MENUITEM SEPARATOR
MENUITEM "E&xit", MAINMENU_FILEQUIT
END
END
PRINTING DIALOG 36, 49, 165, 41
STYLE DS_MODALFRAME | 0x4L | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Printing"
FONT 8, "MS Sans Serif"
{
PUSHBUTTON "Cancel", IDCANCEL, 57, 20, 50, 14
}

29
test/Test.dsw Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "test"=.\test.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

BIN
test/Test.opt Normal file

Binary file not shown.

BIN
test/TestCert.spc Normal file

Binary file not shown.

15
test/UPDATE.HPP Normal file
View File

@@ -0,0 +1,15 @@
class UpdateRegion
{
public:
UpdateRegion(void);
UpdateRegion(const UpdateRegion &someUpdateRegion);
virtual ~UpdateRegion();
UpdateRegion &operator=(const UpdateRegion &someUpdateRegion);
bool operator==(const UpdateRegion &someUpdateRegion)const;
Page &getUpdateRegion();
bool setUpdateRegion(unsigned startRow,unsigned startCol,Page &page);
private:
unsigned mStartRow;
unsigned mStartCol;
Page mPage;
};

86
test/VINFO.HPP Normal file
View File

@@ -0,0 +1,86 @@
#ifndef _TEST_VINFO_HPP_
#define _TEST_VINFO_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
class VInfo
{
public:
VInfo(void);
VInfo(const VInfo &someVInfo);
VInfo(DWORD baseAddress,HDC hDC);
virtual ~VInfo();
VInfo &operator=(const VInfo &someVInfo);
BOOL operator==(const VInfo &someVInfo)const;
DWORD baseAddress(void)const;
void baseAddress(DWORD baseAddress);
HDC hDC(void)const;
void hDC(HDC hDC);
private:
DWORD mBaseAddress;
HDC mhDC;
};
inline
VInfo::VInfo(void)
: mBaseAddress(0), mhDC(0)
{
}
inline
VInfo::VInfo(DWORD baseAddress,HDC hDC)
: mBaseAddress(baseAddress), mhDC(hDC)
{
}
inline
VInfo::VInfo(const VInfo &someVInfo)
{
*this=someVInfo;
}
inline
VInfo::~VInfo()
{
}
inline
VInfo &VInfo::operator=(const VInfo &someVInfo)
{
baseAddress(someVInfo.baseAddress());
hDC(someVInfo.hDC());
return *this;
}
inline
BOOL VInfo::operator==(const VInfo &someVInfo)const
{
return (baseAddress()==someVInfo.baseAddress()&&
hDC()==someVInfo.hDC());
}
inline
DWORD VInfo::baseAddress(void)const
{
return mBaseAddress;
}
inline
void VInfo::baseAddress(DWORD baseAddress)
{
mBaseAddress=baseAddress;
}
inline
HDC VInfo::hDC(void)const
{
return mhDC;
}
inline
void VInfo::hDC(HDC hDC)
{
mhDC=hDC;
}
#endif

27
test/index.html Normal file
View File

@@ -0,0 +1,27 @@
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title></title>
</head>
<body background="paper.gif">
<h2 align="center">Mutual Fund Analysis</h2>
<p><applet code="Proto.class" codebase="./" align="middle"
width="360" height="200" name="Input"><param name="background"value="FFFFFF">
<paramname="cabbase" value=Proto.cab">
<paramname="foreground" value="FFFFFF"></applet>
</p>
<p align="center"><font color="#FF0000">Although the information
provided is gathered from sources deemed reliable,
it's accuracy is not guaranteed.</font></p>
<hr>
<p><br>
</p>
</body>
</html>

70
test/inproc.cpp Normal file
View File

@@ -0,0 +1,70 @@
#include <test/inproc.hpp>
void *InProcServerDemoInstantiator::instantiate(IUnknown *pUnkOuter,REFIID riid,void **ppv)
{
ComResult comResult;
InProcServerDemo *pInProcServerDemo;
pInProcServerDemo=::new InProcServerDemo(pUnkOuter,riid);
if(!pInProcServerDemo)throw Instantiator::NoMemory();
comResult=pInProcServerDemo->QueryInterface(riid,ppv);
if(comResult.isFailure())
{
::delete pInProcServerDemo;
throw Instantiator::NoInterface();
}
return pInProcServerDemo;
}
InProcServerDemo::InProcServerDemo(IUnknown *pUnkOuter,REFIID riid)
: mValue(0), mRefCount(0)
{
// getConsole().writeLine("<InProcServerDemo::InProcServerDemo>");
if(!IsEqualIID(riid,IID_IDemo))throw Instantiator::NoInterface();
}
InProcServerDemo::~InProcServerDemo()
{
// getConsole().writeLine("<InProcServerDemo::~InProcServerDemo>");
}
HRESULT __stdcall InProcServerDemo::getValue(int *pvalue)
{
// getConsole().writeLine("<InProcServerDemo::getValue>");
if(!pvalue)return ComResult::InvalidArg;
*pvalue=mValue;
return ComResult::NoError;
}
HRESULT __stdcall InProcServerDemo::setValue(int value)
{
// getConsole().writeLine("<InProcServerDemo::setValue>");
mValue=value;
return ComResult::NoError;
}
HRESULT __stdcall InProcServerDemo::QueryInterface(REFIID riid,void **ppv)
{
// getConsole().writeLine("<InProcServer::QueryInterface>");
*ppv=0;
if(IsEqualIID(riid,IID_IUnknown)||IsEqualIID(riid,IID_IDemo))
{
*ppv=this;
AddRef();
return NOERROR;
}
return ComResult::NoInterface;
}
ULONG __stdcall InProcServerDemo::AddRef(void)
{
// getConsole().writeLine("<InProcServer::AddRef>");
return ++mRefCount;
}
ULONG __stdcall InProcServerDemo::Release(void)
{
// getConsole().writeLine("<InProcServer::Release>");
if(0==--mRefCount)::delete this;
return mRefCount;
}

113
test/inproc.dsp Normal file
View File

@@ -0,0 +1,113 @@
# Microsoft Developer Studio Project File - Name="inproc" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=inproc - 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 "inproc.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 "inproc.mak" CFG="inproc - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "inproc - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "inproc - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "inproc - 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 Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
!ELSEIF "$(CFG)" == "inproc - 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 "msvcobj"
# PROP Intermediate_Dir "msvcobj"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MTd /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "__FLAT__" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "inproc - Win32 Release"
# Name "inproc - Win32 Debug"
# Begin Source File
SOURCE=.\demo.c
# End Source File
# Begin Source File
SOURCE=.\inproc.cpp
# End Source File
# Begin Source File
SOURCE=.\inproc.def
# End Source File
# Begin Source File
SOURCE=..\com\msvcobj\inproc.lib
# End Source File
# Begin Source File
SOURCE=..\Exe\mscommon.lib
# End Source File
# Begin Source File
SOURCE=.\test.cpp
# End Source File
# End Target
# End Project

37
test/inproc.hpp Normal file
View File

@@ -0,0 +1,37 @@
#ifndef _TEST_INPROCSERVERDEMO_HPP_
#define _TEST_INPROCSERVERDEMO_HPP_
#ifndef _COMMON_CONSOLE_HPP_
#include <common/console.hpp>
#endif
#ifndef _COM_COM_HPP_
#include <com/com.hpp>
#endif
#ifndef _COM_INSTANTIATOR_HPP_
#include <com/instance.hpp>
#endif
#ifndef _TEST_DEMO_HPP_
#include <test/demo.hpp>
#endif
class InProcServerDemoInstantiator : public Instantiator
{
public:
virtual void *instantiate(IUnknown *pUnkOuter,REFIID riid,void **ppv);
};
class InProcServerDemo : public IDemo
{
public:
InProcServerDemo(IUnknown *pUnkOuter,REFIID riid);
~InProcServerDemo();
HRESULT __stdcall QueryInterface(REFIID riid,void **ppv);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall getValue(int *pvalue);
HRESULT __stdcall setValue(int value);
private:
int mValue;
int mRefCount;
};
#endif

96
test/ipdemo.cpp Normal file
View File

@@ -0,0 +1,96 @@
#include <com/com.hpp>
#include <test/ipdemo.hpp>
InProcServerDemo::InProcServerDemo(IUnknown *pUnkOuter,REFIID riid,Console &winConsole)
//: InProcServer(pUnkOuter,riid,winConsole), mValue(0)
: mValue(0), mRefCount(0), mWinConsole(winConsole)
{
getConsole().writeLine("<InProcServerDemo::InProcServerDemo>");
if(!IsEqualIID(riid,IID_IDemo))throw InProcServerDemo::InProcServerDemoNoInterface();
}
InProcServerDemo::~InProcServerDemo()
{
getConsole().writeLine("<InProcServerDemo::~InProcServerDemo>");
}
REFIID InProcServerDemo::getREFIID(void)
{
getConsole().writeLine("<InProcServerDemo::getREFIID>");
return IID_IDemo;
}
void *InProcServerDemo::getInstance(void)
{
getConsole().writeLine("<InProcServerDemo::getInstance>");
return (void*)this;
}
HRESULT __stdcall InProcServerDemo::getValue(int *pvalue)
{
getConsole().writeLine("<InProcServerDemo::getValue>");
if(!pvalue)return ComResult::InvalidArg;
*pvalue=mValue;
return ComResult::NoError;
}
HRESULT __stdcall InProcServerDemo::setValue(int value)
{
getConsole().writeLine("<InProcServerDemo::setValue>");
mValue=value;
return ComResult::NoError;
}
HRESULT __stdcall InProcServerDemo::QueryInterface(REFIID riid,void **ppv)
{
getConsole().writeLine("<InProcServer::QueryInterface>");
*ppv=0;
if(IsEqualIID(riid,IID_IUnknown)||IsEqualIID(riid,getREFIID()))
{
*ppv=getInstance();
// *ppv=this;
AddRef();
return NOERROR;
}
return ComResult::NoInterface;
}
ULONG __stdcall InProcServerDemo::AddRef(void)
{
getConsole().writeLine("<InProcServer::AddRef>");
return ++mRefCount;
}
ULONG __stdcall InProcServerDemo::Release(void)
{
getConsole().writeLine("<InProcServer::Release>");
if(0==--mRefCount)::delete this;
return mRefCount;
}
#if 0
HRESULT __stdcall InProcServerDemo::QueryInterface(REFIID riid,void **ppv)
{
getConsole().writeLine("<InProcServerDemo::QueryInterface>");
return InProcServer::QueryInterface(riid,ppv);
}
ULONG __stdcall InProcServerDemo::AddRef(void)
{
getConsole().writeLine("<InProcServerDemo::AddRef>");
return InProcServer::AddRef();
}
ULONG __stdcall InProcServerDemo::Release(void)
{
getConsole().writeLine("<InProcServerDemo::Release>");
return InProcServer::Release();
}
#endif
Console &InProcServerDemo::getConsole(void)
{
return mWinConsole;
}

32
test/ipdemo.hpp Normal file
View File

@@ -0,0 +1,32 @@
#ifndef _TEST_INPROCSERVERDEMO_HPP_
#define _TEST_INPROCSERVERDEMO_HPP_
#ifndef _COMMON_CONSOLE_HPP_
#include <common/console.hpp>
#endif
#ifndef _TEST_DEMO_HPP_
#include <test/demo.hpp>
#endif
//class InProcServerDemo : public InProcServer, public IDemo
class InProcServerDemo : public IDemo
{
public:
class InProcServerDemoNoInterface{};
InProcServerDemo(IUnknown *pUnkOuter,REFIID riid,Console &winConsole);
~InProcServerDemo();
HRESULT __stdcall QueryInterface(REFIID riid,void **ppv);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall getValue(int *pvalue);
HRESULT __stdcall setValue(int value);
protected:
virtual REFIID getREFIID(void);
virtual void *getInstance(void);
Console &getConsole(void);
private:
int mValue;
int mRefCount;
Console &mWinConsole;
};
#endif

121
test/jtest.dsp Normal file
View File

@@ -0,0 +1,121 @@
# Microsoft Developer Studio Project File - Name="jtest" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=jtest - 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 "jtest.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 "jtest.mak" CFG="jtest - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "jtest - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "jtest - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "jtest - 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 Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "jtest - 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 Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /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 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "jtest - Win32 Release"
# Name "jtest - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Proto.java
!IF "$(CFG)" == "jtest - Win32 Release"
!ELSEIF "$(CFG)" == "jtest - Win32 Debug"
# Begin Custom Build
OutDir=.\Debug
InputPath=.\Proto.java
"$(OutDir)" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
c:\parts\jdk\bin\javac -deprecation $(InputPath)
# End Custom Build
!ENDIF
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

29
test/jtest.dsw Normal file
View File

@@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "jtest"=.\jtest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

BIN
test/jtest.opt Normal file

Binary file not shown.

13
test/jtest.sln Normal file
View File

@@ -0,0 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 1.00
Project("{66355F20-A65B-11D0-BFB5-00A0C91EBFA0}") = "jtest", "jtest.vjp", "{5EE5BA03-CEC1-11D3-B501-005004E82B58}"
EndProject
Global
GlobalSection(LocalDeployment) = postSolution
StartupProject = {5EE5BA03-CEC1-11D3-B501-005004E82B58}
EndGlobalSection
GlobalSection(BuildOrder) = postSolution
0 = {5EE5BA03-CEC1-11D3-B501-005004E82B58}
EndGlobalSection
GlobalSection(DeploymentRoot) = postSolution
EndGlobalSection
EndGlobal

BIN
test/jtest.suo Normal file

Binary file not shown.

BIN
test/jtest.vjp Normal file

Binary file not shown.

BIN
test/proto.cab Normal file

Binary file not shown.

BIN
test/res/Toolbar.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
test/res/test.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

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