summaryrefslogtreecommitdiffstats
path: root/private/oleutest/perf16/idata/client
diff options
context:
space:
mode:
Diffstat (limited to 'private/oleutest/perf16/idata/client')
-rw-r--r--private/oleutest/perf16/idata/client/datausr.cpp1260
-rw-r--r--private/oleutest/perf16/idata/client/datausr.h226
-rw-r--r--private/oleutest/perf16/idata/client/datausr.icobin0 -> 766 bytes
-rw-r--r--private/oleutest/perf16/idata/client/idatausr.def9
-rw-r--r--private/oleutest/perf16/idata/client/idatausr.rc120
-rw-r--r--private/oleutest/perf16/idata/client/make16.inc331
-rw-r--r--private/oleutest/perf16/idata/client/make16.mak58
-rw-r--r--private/oleutest/perf16/idata/client/makefile10
-rw-r--r--private/oleutest/perf16/idata/client/perror.cpp76
-rw-r--r--private/oleutest/perf16/idata/client/perror.h36
-rw-r--r--private/oleutest/perf16/idata/client/sources85
-rw-r--r--private/oleutest/perf16/idata/client/stgmedif.cpp60
-rw-r--r--private/oleutest/perf16/idata/client/stpwatch.cpp145
-rw-r--r--private/oleutest/perf16/idata/client/stpwatch.h28
14 files changed, 2444 insertions, 0 deletions
diff --git a/private/oleutest/perf16/idata/client/datausr.cpp b/private/oleutest/perf16/idata/client/datausr.cpp
new file mode 100644
index 000000000..eec3dc697
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/datausr.cpp
@@ -0,0 +1,1260 @@
+/*
+ * DATAUSER.CPP
+ * Data Object User Chapter 6
+ *
+ * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
+ *
+ * Kraig Brockschmidt, Software Design Engineer
+ * Microsoft Systems Developer Relations
+ *
+ * Internet : kraigb@microsoft.com
+ * Compuserve: >INTERNET:kraigb@microsoft.com
+ */
+
+
+#define INIT_MY_GUIDS
+#include "datausr.h"
+#include "perror.h"
+#include <stdio.h>
+
+#ifdef WIN32
+#define APP_TITLE TEXT("32 Bit IDataObject User")
+#else
+#define APP_TITLE TEXT("16 Bit IDataObject User")
+#endif
+
+//These are for displaying clipboard formats textually.
+static TCHAR * rgszCF[13]={TEXT("Unknown"), TEXT("CF_TEXT")
+ , TEXT("CF_BITMAP"), TEXT("CF_METAFILEPICT")
+ , TEXT("CF_SYLK"), TEXT("CF_DIF"), TEXT("CF_TIFF")
+ , TEXT("CF_OEMTEXT"), TEXT("CF_DIB")
+ , TEXT("CF_PALETTE"), TEXT("CF_PENDATA")
+ , TEXT("CF_RIFF"), TEXT("CF_WAVE")};
+
+
+static TCHAR szSuccess[] =TEXT("succeeded");
+static TCHAR szFailed[] =TEXT("failed");
+static TCHAR szExpected[] =TEXT("expected");
+static TCHAR szUnexpected[] =TEXT("unexpected!");
+
+TCHAR tcMessageBuf[4096]; // Misc use buffer for messages.
+int cKSizes[NUM_POINTS] = { 1, 2, 4, 6, 8,
+ 10, 12, 16, 20, 24,
+ 28, 32, 40, 48, 56 };
+
+/*
+ * WinMain
+ *
+ * Purpose:
+ * Main entry point of application.
+ */
+
+int PASCAL WinMain(
+ HINSTANCE hInst,
+ HINSTANCE hInstPrev,
+ LPSTR pszCmdLine,
+ int nCmdShow)
+{
+ MSG msg;
+ PAPPVARS pAV;
+
+#ifndef WIN32
+ int cMsg=96;
+
+ while (!SetMessageQueue(cMsg) && (cMsg-=8));
+#endif
+
+ pAV=new CAppVars(hInst, hInstPrev, nCmdShow);
+
+ if (NULL==pAV)
+ return -1;
+
+ if (pAV->FInit())
+ {
+ while (GetMessage(&msg, NULL, 0,0 ))
+ {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+
+ delete pAV;
+ return msg.wParam;
+}
+
+
+
+
+/*
+ * DataUserWndProc
+ *
+ * Purpose:
+ * Window class procedure. Standard callback.
+ */
+
+LRESULT API_ENTRY DataUserWndProc(HWND hWnd, UINT iMsg
+ , WPARAM wParam, LPARAM lParam)
+ {
+ HRESULT hr;
+ PAPPVARS pAV;
+ HMENU hMenu;
+ FORMATETC fe;
+ WORD wID;
+ int i;
+
+ pAV=(PAPPVARS)GetWindowLong(hWnd, DATAUSERWL_STRUCTURE);
+
+ switch (iMsg)
+ {
+ case WM_NCCREATE:
+ pAV=(PAPPVARS)((LPCREATESTRUCT)lParam)->lpCreateParams;
+ SetWindowLong(hWnd, DATAUSERWL_STRUCTURE, (LONG)pAV);
+ return (DefWindowProc(hWnd, iMsg, wParam, lParam));
+
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ break;
+
+ case WM_PAINT:
+ pAV->Paint();
+ break;
+
+ case WM_COMMAND:
+ SETDefFormatEtc(fe, 0, TYMED_HGLOBAL | TYMED_GDI| TYMED_MFPICT);
+
+ hMenu=GetMenu(hWnd);
+ wID=LOWORD(wParam);
+
+ if(wID >= IDM_OBJECTSETDATA && wID <= IDM_OBJECTSETDATA+64)
+ {
+ // Blast all possible SetData menu items. Some don't exist.
+ for(i=IDM_OBJECTSETDATA; i<=IDM_OBJECTSETDATA+64; i++)
+ CheckMenuItem(hMenu,i, MF_UNCHECKED);
+ CheckMenuItem(hMenu, wID, MF_CHECKED);
+
+ pAV->m_SetData_SetSize(wID-IDM_OBJECTSETDATA);
+ break;
+ }
+
+ switch (wID)
+ {
+ case IDM_USE16BITSERVER:
+ if (pAV->m_f16Bit)
+ break;
+ pAV->m_f16Bit = TRUE;
+ pAV->FReloadDataObjects(TRUE);
+ break;
+
+ case IDM_USE32BITSERVER:
+ if (!pAV->m_f16Bit)
+ break;
+ pAV->m_f16Bit = FALSE;
+ pAV->FReloadDataObjects(TRUE);
+ break;
+
+ case IDM_OBJECTQUERYGETDATA:
+ if (NULL==pAV->m_pIDataObject)
+ break;
+
+ fe.tymed=TYMED_HGLOBAL | TYMED_GDI
+ | TYMED_MFPICT;
+
+ pAV->TryQueryGetData(&fe, CF_TEXT, TRUE, 0);
+ pAV->TryQueryGetData(&fe, CF_BITMAP, TRUE, 1);
+#ifdef NOT_SIMPLE
+ pAV->TryQueryGetData(&fe, CF_DIB, FALSE, 2);
+ pAV->TryQueryGetData(&fe, CF_METAFILEPICT, TRUE, 3);
+ pAV->TryQueryGetData(&fe, CF_WAVE, FALSE, 4);
+#endif /* NOT_SIMPLE */
+ break;
+
+
+ case IDM_OBJECTGETDATA_TEXT:
+ case IDM_OBJECTGETDATA_BITMAP:
+#ifdef NOT_SIMPLE
+ case IDM_OBJECTGETDATA_METAFILEPICT:
+#endif /* NOT_SIMPLE */
+ if (pAV->m_GetData(wID) )
+ {
+ InvalidateRect(hWnd, NULL, TRUE);
+ UpdateWindow(hWnd);
+ }
+
+ if(pAV->m_fDisplayTime)
+ pAV->m_DisplayTimerResults();
+ break;
+
+ case IDM_OBJECTGETDATAHERE_TEXT:
+ case IDM_OBJECTGETDATAHERE_NULLTEXT:
+ case IDM_OBJECTGETDATAHERE_BITMAP:
+ case IDM_OBJECTGETDATAHERE_NULLBITMAP:
+ if (pAV->m_GetDataHere(wID) )
+ {
+ InvalidateRect(hWnd, NULL, TRUE);
+ UpdateWindow(hWnd);
+ }
+
+ if(pAV->m_fDisplayTime)
+ pAV->m_DisplayTimerResults();
+ break;
+
+ case IDM_OBJECTSETDATAPUNK_TEXT:
+ case IDM_OBJECTSETDATAPUNK_BITMAP:
+ pAV->m_SetData_WithPUnk(wID);
+ break;
+
+ case IDM_MEASUREMENT_1:
+ case IDM_MEASUREMENT_50:
+ case IDM_MEASUREMENT_300:
+ case IDM_MEASUREMENT_OFF:
+ case IDM_MEASUREMENT_ON:
+ case IDM_MEASUREMENT_TEST:
+ pAV->m_SetMeasurement(wID);
+ break;
+
+ case IDM_BATCH_GETDATA:
+ pAV->m_MeasureAllSizes(IDM_OBJECTGETDATA_TEXT,
+ TEXT("GetData w/HGLOBAL"),
+ NULL);
+ break;
+
+ case IDM_BATCH_GETDATAHERE:
+ pAV->m_MeasureAllSizes(IDM_OBJECTGETDATAHERE_TEXT,
+ TEXT("GetDataHere w/HGLOBAL"),
+ NULL);
+ break;
+
+ case IDM_BATCHTOFILE:
+ pAV->m_BatchToFile();
+ break;
+
+ case IDM_OBJECTEXIT:
+ PostMessage(hWnd, WM_CLOSE, 0, 0L);
+ break;
+
+#ifdef NOT_SIMPLE
+ case IDM_ADVISETEXT:
+ case IDM_ADVISEBITMAP:
+ case IDM_ADVISEMETAFILEPICT:
+ if (NULL==pAV->m_pIDataObject)
+ break;
+
+ //Terminate the old connection
+ if (0!=pAV->m_dwConn)
+ {
+ pAV->m_pIDataObject->DUnadvise(pAV
+ ->m_dwConn);
+ }
+
+ CheckMenuItem(hMenu, pAV->m_cfAdvise
+ +IDM_ADVISEMIN, MF_UNCHECKED);
+ CheckMenuItem(hMenu, wID, MF_CHECKED);
+
+ //New format is wID-IDM_ADVISEMIN
+ pAV->m_cfAdvise=(UINT)(wID-IDM_ADVISEMIN);
+ fe.cfFormat=pAV->m_cfAdvise;
+ pAV->m_pIDataObject->DAdvise(&fe, ADVF_NODATA
+ , pAV->m_pIAdviseSink, &pAV->m_dwConn);
+
+ break;
+
+ case IDM_ADVISEGETDATA:
+ pAV->m_fGetData=!pAV->m_fGetData;
+ CheckMenuItem(hMenu, wID, pAV->m_fGetData
+ ? MF_CHECKED : MF_UNCHECKED);
+ break;
+
+ case IDM_ADVISEREPAINT:
+ pAV->m_fRepaint=!pAV->m_fRepaint;
+ CheckMenuItem(hMenu, wID, pAV->m_fRepaint
+ ? MF_CHECKED : MF_UNCHECKED);
+ break;
+#endif /* NOT_SIMPLE*/
+ default:
+ break;
+ }
+ break;
+
+ default:
+ return (DefWindowProc(hWnd, iMsg, wParam, lParam));
+ }
+
+ return 0L;
+ }
+
+
+/*
+ * CAppVars::CAppVars
+ * CAppVars::~CAppVars
+ *
+ * Constructor Parameters: (from WinMain)
+ * hInst HINSTANCE of the application.
+ * hInstPrev HINSTANCE of a previous instance.
+ * nCmdShow UINT specifying how to show the app window.
+ */
+
+CAppVars::CAppVars(HINSTANCE hInst, HINSTANCE hInstPrev
+ , UINT nCmdShow)
+ {
+ m_hInst =hInst;
+ m_hInstPrev =hInstPrev;
+ m_nCmdShow =nCmdShow;
+
+ m_hWnd =NULL;
+#ifdef NOT_SIMPLE
+ m_fEXE =FALSE;
+
+ m_pIAdviseSink =NULL;
+ m_dwConn =0;
+ m_cfAdvise =0;
+ m_fGetData =FALSE;
+ m_fRepaint =FALSE;
+
+ m_pIDataSmall =NULL;
+ m_pIDataMedium=NULL;
+ m_pIDataLarge =NULL;
+#endif /* NOT_SIMPLE */
+ m_pIDataObject=NULL;
+ m_f16Bit=FALSE;
+ m_cfFormat=0;
+ m_stm.tymed=TYMED_NULL;
+ m_stm.lpszFileName=NULL; //Initializes union to NULL
+ m_stm.pUnkForRelease=NULL;
+
+ m_HereAllocCount=0; // For debugging
+
+ m_fInitialized=FALSE;
+ return;
+ }
+
+
+
+CAppVars::~CAppVars(void)
+ {
+ //This releases the data object interfaces and advises
+ FReloadDataObjects(FALSE);
+
+ ReleaseStgMedium(&m_stm);
+
+#ifdef NOT_SIMPLE
+ if (NULL!=m_pIAdviseSink)
+ m_pIAdviseSink->Release();
+#endif /* NOT_SIMPLE */
+
+ if (IsWindow(m_hWnd))
+ DestroyWindow(m_hWnd);
+
+ if (m_fInitialized)
+ CoUninitialize();
+
+ return;
+ }
+
+
+
+/*
+ * CAppVars::FInit
+ *
+ * Purpose:
+ * Initializes an CAppVars object by registering window classes,
+ * creating the main window, and doing anything else prone to
+ * failure such as calling CoInitialize. If this function fails
+ * the caller should insure that the destructor is called.
+ *
+ * Parameters:
+ * None
+ *
+ * Return Value:
+ * BOOL TRUE if successful, FALSE otherwise.
+ */
+
+BOOL CAppVars::FInit(void)
+ {
+ WNDCLASS wc;
+ DWORD dwVer;
+ BOOL fRet;
+
+ dwVer=CoBuildVersion();
+
+ if (rmm!=HIWORD(dwVer))
+ return FALSE;
+
+ if (FAILED(CoInitialize(NULL)))
+ return FALSE;
+
+ m_fInitialized=TRUE;
+
+ //Register our window classes.
+ if (!m_hInstPrev)
+ {
+ wc.style = CS_HREDRAW | CS_VREDRAW;
+ wc.lpfnWndProc = DataUserWndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = CBWNDEXTRA;
+ wc.hInstance = m_hInst;
+ wc.hIcon = LoadIcon(m_hInst, TEXT("Icon"));
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
+ wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
+ wc.lpszClassName = TEXT("DATAUSER");
+
+ if (!RegisterClass(&wc))
+ return FALSE;
+ }
+
+ //Create the main window.
+ m_hWnd=CreateWindow(TEXT("DATAUSER"),
+ APP_TITLE,
+ WS_OVERLAPPEDWINDOW,
+ 35, 35, 350, 250,
+ NULL, NULL,
+ m_hInst, this);
+
+ if (NULL==m_hWnd)
+ return FALSE;
+
+ ShowWindow(m_hWnd, m_nCmdShow);
+ UpdateWindow(m_hWnd);
+
+ m_iDataSizeIndex=1;
+ CheckMenuItem(GetMenu(m_hWnd), IDM_OBJECTSETDATA+1, MF_CHECKED);
+ for(int i=0; i<64; i++)
+ m_hgHereBuffers[i] = NULL;
+
+ m_cIterations = 1;
+ CheckMenuItem(GetMenu(m_hWnd), IDM_MEASUREMENT_1, MF_CHECKED);
+
+ m_fDisplayTime = FALSE;
+ CheckMenuItem(GetMenu(m_hWnd), IDM_MEASUREMENT_OFF, MF_CHECKED);
+
+#ifdef NOT_SIMPLE
+ m_pIAdviseSink=new CImpIAdviseSink(this);
+
+ if (NULL==m_pIAdviseSink)
+ return FALSE;
+
+ m_pIAdviseSink->AddRef();
+
+ CheckMenuItem(GetMenu(m_hWnd), IDM_OBJECTUSEDLL, MF_CHECKED);
+ CheckMenuItem(GetMenu(m_hWnd), IDM_OBJECTDATASIZESMALL
+ , MF_CHECKED);
+#endif /* NOT_SIMPLE */
+
+ //Load the initial objects
+ fRet=FReloadDataObjects(TRUE);
+#ifdef NOT_SIMPLE
+ m_pIDataObject=m_pIDataSmall;
+#endif /* NOT_SIMPLE */
+
+ m_swTimer.m_ClassInit();
+
+ return fRet;
+ }
+
+
+/*
+ * CAppVars::FReloadDataObjects
+ *
+ * Purpose:
+ * Releases the old data objects we're holding on to and reloads
+ * the new ones from either EXE or DLL depending on m_fEXE.
+ *
+ * Parameters:
+ * fReload BOOL indicating if we are to recreate everything
+ * or just release the old ones (so we can use this
+ * from the destructor).
+ *
+ * Return Value:
+ * BOOL TRUE if there are usable objects in us now.
+ */
+
+BOOL CAppVars::FReloadDataObjects(BOOL fReload)
+ {
+ HCURSOR hCur, hCurT;
+
+ //Clean out any data we're holding
+ m_cfFormat=0;
+ ReleaseStgMedium(&m_stm);
+
+ //Turn off whatever data connection we have
+#ifdef NOT_SIMPLE
+ if (NULL!=m_pIDataObject && 0!=m_dwConn)
+ m_pIDataObject->DUnadvise(m_dwConn);
+
+ if (NULL!=m_pIDataLarge)
+ m_pIDataLarge->Release();
+
+ if (NULL!=m_pIDataMedium)
+ m_pIDataMedium->Release();
+
+ if (NULL!=m_pIDataSmall)
+ m_pIDataSmall->Release();
+#else /* IS SIMPLE */
+ if (NULL != m_pIDataObject)
+ m_pIDataObject->Release();
+#endif /* NOT_SIMPLE */
+
+ m_pIDataObject=NULL;
+ CoFreeUnusedLibraries();
+
+ //Exit if we just wanted to free.
+ if (!fReload)
+ return FALSE;
+
+
+ hCur=LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT));
+ hCurT=SetCursor(hCur);
+ ShowCursor(TRUE);
+
+#ifdef NOT_SIMPLE
+ HRESULT hr1, hr2, hr3;
+ DWORD dwClsCtx;
+
+ dwClsCtx=(m_fEXE) ? CLSCTX_LOCAL_SERVER : CLSCTX_INPROC_SERVER;
+
+ hr1=CoCreateInstance(CLSID_DataObjectSmall, NULL, dwClsCtx
+ , IID_IDataObject, (PPVOID)&m_pIDataSmall);
+
+ hr2=CoCreateInstance(CLSID_DataObjectMedium, NULL, dwClsCtx
+ , IID_IDataObject, (PPVOID)&m_pIDataMedium);
+
+ hr3=CoCreateInstance(CLSID_DataObjectLarge, NULL, dwClsCtx
+ , IID_IDataObject, (PPVOID)&m_pIDataLarge);
+#else /* IS SIMPLE */
+ HRESULT hr;
+
+ if(m_f16Bit)
+ {
+ hr = CoCreateInstance(CLSID_DataObjectTest16,
+ NULL,
+ CLSCTX_LOCAL_SERVER,
+ IID_IDataObject,
+ (PPVOID)&m_pIDataObject);
+ }else
+ {
+ hr = CoCreateInstance(CLSID_DataObjectTest32,
+ NULL,
+ CLSCTX_LOCAL_SERVER,
+ IID_IDataObject,
+ (PPVOID)&m_pIDataObject);
+ }
+
+#endif /* NOT_SIMPLE */
+
+ ShowCursor(FALSE);
+ SetCursor(hCurT);
+
+ //If anything fails, recurse to clean up...
+#ifdef NOT_SIMPLE
+ if (FAILED(hr1) || FAILED(hr2) || FAILED(hr3))
+#else /* IS SIMPLE */
+ if (FAILED(hr))
+#endif /* NOT_SIMPLE */
+ {
+ perror_OKBox(0, TEXT("CoCreateInstance Failed: "), hr);
+ return FReloadDataObjects(FALSE);
+ }
+
+ HMENU hMenu = GetMenu(m_hWnd);
+ UINT uTempD, uTempE;
+
+ if(m_f16Bit)
+ {
+ CheckMenuItem(hMenu, IDM_USE16BITSERVER, MF_CHECKED);
+ CheckMenuItem(hMenu, IDM_USE32BITSERVER, MF_UNCHECKED);
+ }
+ else
+ {
+ CheckMenuItem(hMenu, IDM_USE16BITSERVER, MF_UNCHECKED);
+ CheckMenuItem(hMenu, IDM_USE32BITSERVER, MF_CHECKED);
+ }
+
+
+ hMenu=GetMenu(m_hWnd);
+ for(int i=IDM_OBJECTSETDATA; i<=IDM_OBJECTSETDATA+64; i++)
+ {
+ CheckMenuItem(hMenu, i, MF_UNCHECKED);
+ }
+ m_iDataSizeIndex = 1;
+ CheckMenuItem(hMenu,
+ IDM_OBJECTSETDATA + m_iDataSizeIndex,
+ MF_CHECKED);
+
+ //Reset the state of the menus for Small, no advise, no options.
+#ifdef NOT_SIMPLE
+ CheckMenuItem(hMenu, IDM_OBJECTDATASIZESMALL, MF_CHECKED);
+ CheckMenuItem(hMenu, IDM_OBJECTDATASIZEMEDIUM, MF_UNCHECKED);
+ CheckMenuItem(hMenu, IDM_OBJECTDATASIZELARGE, MF_UNCHECKED);
+
+ m_pIDataObject=m_pIDataSmall;
+ CheckMenuItem(hMenu, m_cfAdvise+IDM_ADVISEMIN, MF_UNCHECKED);
+
+ uTempE=m_fEXE ? MF_CHECKED : MF_UNCHECKED;
+ uTempD=!m_fEXE ? MF_CHECKED : MF_UNCHECKED;
+
+ CheckMenuItem(hMenu, IDM_OBJECTUSEDLL, uTempD);
+ CheckMenuItem(hMenu, IDM_OBJECTUSEEXE, uTempE);
+
+ CheckMenuItem(hMenu, IDM_ADVISEGETDATA, MF_UNCHECKED);
+ CheckMenuItem(hMenu, IDM_ADVISEREPAINT, MF_UNCHECKED);
+
+ m_fGetData=FALSE;
+ m_fRepaint=FALSE;
+
+ //Cannot request data using async advises, so disable these.
+ uTempE=m_fEXE ? MF_DISABLED | MF_GRAYED : MF_ENABLED;
+ EnableMenuItem(hMenu, IDM_ADVISEGETDATA, uTempE);
+ EnableMenuItem(hMenu, IDM_ADVISEREPAINT, uTempE);
+#endif /* NOT_SIMPLE */
+ return TRUE;
+ }
+
+
+
+/*
+ * CAppVars::TryQueryGetData
+ *
+ * Purpose:
+ * Centralized function call and output code for displaying results
+ * of various IDataObject::QueryGetData calls.
+ *
+ * Parameters:
+ * pFE LPFORMATETC to test.
+ * cf UINT specific clipboard format to stuff in pFE
+ * before calling. If zero, use whatever is
+ * already in pFE.
+ * fExpect BOOL indicating expected results
+ * y UINT line on which to print results.
+ *
+ * Return Value:
+ * None
+ */
+
+void CAppVars::TryQueryGetData(LPFORMATETC pFE, UINT cf
+ , BOOL fExpect, UINT y)
+ {
+ TCHAR szTemp[80];
+ LPTSTR psz1;
+ LPTSTR psz2;
+ UINT cch;
+ HRESULT hr;
+ HDC hDC;
+
+ if (0!=cf)
+ pFE->cfFormat=cf;
+
+ hr=m_pIDataObject->QueryGetData(pFE);
+ psz1=(NOERROR==hr) ? szSuccess : szFailed;
+ psz2=((NOERROR==hr)==fExpect) ? szExpected : szUnexpected;
+
+ hDC=GetDC(m_hWnd);
+ SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
+ SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
+
+ if (CF_WAVE < cf || 0==cf)
+ {
+ cch=wsprintf(szTemp, TEXT("QueryGetData on %d %s (%s).")
+ , cf, psz1, psz2);
+ }
+ else
+ {
+ cch=wsprintf(szTemp, TEXT("QueryGetData on %s %s (%s).")
+ , (LPTSTR)rgszCF[cf], psz1, psz2);
+ }
+
+ //Don't overwrite other painted display.
+ SetBkMode(hDC, TRANSPARENT);
+ TextOut(hDC, 0, 16*y, szTemp, cch);
+
+ ReleaseDC(m_hWnd, hDC);
+
+ return;
+ }
+
+
+int
+CAppVars::m_GetData(WORD wID)
+{
+ FORMATETC fe;
+ HRESULT hr;
+
+ if (NULL == m_pIDataObject)
+ return(0); // Don't redraw.
+
+ //Clean up whatever we currently have.
+ m_cfFormat = 0;
+ ReleaseStgMedium(&m_stm);
+
+ switch (wID)
+ {
+ case IDM_OBJECTGETDATA_TEXT:
+ SETDefFormatEtc(fe, CF_TEXT, TYMED_HGLOBAL);
+ break;
+
+#ifdef NOT_SIMPLE
+ case IDM_OBJECTGETDATA_BITMAP:
+ SETDefFormatEtc(fe, CF_BITMAP, TYMED_GDI);
+ break;
+
+ case IDM_OBJECTGETDATA_METAFILEPICT:
+ SETDefFormatEtc(fe, CF_METAFILEPICT, TYMED_MFPICT);
+ break;
+#endif /* NOT_SIMPLE */
+
+ default:
+ MessageBox(0,
+ TEXT("Type is Unsupported in the Client"),
+ TEXT("GetData"),
+ MB_OK);
+ return(0);
+ }
+
+ m_swTimer.m_Start();
+ HRESULT didfail = NOERROR;
+
+ for(int i=0; i<m_cIterations; i++)
+ {
+ hr = m_pIDataObject->GetData(&fe, &m_stm);
+ if (SUCCEEDED(hr))
+ {
+ // If we are just whacking off for the benchmark.
+ // Then release all but the last one we recieve.
+ if(i < m_cIterations-1)
+ ReleaseStgMedium(&m_stm);
+ }
+ else
+ didfail = hr;
+ }
+ m_swTimer.m_Stop();
+
+ if (SUCCEEDED(didfail))
+ m_cfFormat=fe.cfFormat;
+ else
+ {
+ perror_OKBox(0,
+ TEXT("GetData Failed"),
+ didfail);
+ }
+
+ return(1); // Do redraw even if it failed (draw blank).
+}
+
+
+int
+CAppVars::m_GetDataHere(WORD wID)
+{
+ FORMATETC fe;
+ HRESULT hr;
+
+ if(NULL == m_pIDataObject)
+ return(0); // Don't redraw
+
+ m_cfFormat = 0;
+
+ // Don't Release the STGMedium. We recycle them!
+
+ switch(wID)
+ {
+ case IDM_OBJECTGETDATAHERE_TEXT:
+ SETDefFormatEtc(fe, CF_TEXT, TYMED_HGLOBAL);
+ break;
+
+ case IDM_OBJECTGETDATAHERE_NULLTEXT:
+ SETDefFormatEtc(fe, CF_TEXT, TYMED_NULL);
+ break;
+
+ /* Other cases go here.... */
+
+ default:
+ MessageBox(0,
+ TEXT("Type is Unsupported in the Client"),
+ TEXT("GetDataHere"),
+ MB_OK);
+ return(0);
+ }
+
+ HGLOBAL* phg = &m_hgHereBuffers[m_iDataSizeIndex];
+ if(NULL == *phg)
+ {
+ ++m_HereAllocCount;
+ *phg = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE,
+ DATASIZE_FROM_INDEX(m_iDataSizeIndex) );
+ if(NULL == *phg)
+ {
+ MessageBox(0,
+ TEXT("GlobalAlloc Return NULL"),
+ TEXT("Failure"),
+ MB_OK);
+ PostQuitMessage(0);
+ return(0); // Don't redraw
+ }
+ }
+
+ m_stm.hGlobal=*phg;
+ m_stm.tymed=TYMED_HGLOBAL;
+ m_stm.pUnkForRelease=NULL;
+
+ // The TYMED_NULL case tests code in olethk where it is written:
+ // "If tymed == TYMED_NULL then GetDataHere should behave like GetData."
+ // I can't find this in any manual (OLE2 or Ole). I wanted to see what
+ // good that code was. (there is also bug #15974) Aug 8th 1995 BChapman.
+
+ if (IDM_OBJECTGETDATAHERE_NULLTEXT == wID)
+ {
+ m_stm.hGlobal=NULL;
+ m_stm.tymed=TYMED_NULL;
+ }
+
+ // The other side "knows" the size of the data.
+ // (It is told via. SetData)
+
+ HRESULT didfail = NOERROR;
+ m_swTimer.m_Start();
+ for(int i=0; i<m_cIterations; i++)
+ {
+ hr = m_pIDataObject->GetDataHere(&fe, &m_stm);
+ if (FAILED(hr))
+ didfail = hr;
+ // We don't ReleaseSTGMedium because this
+ // is GetDataHere !
+ }
+ m_swTimer.m_Stop();
+
+ if (SUCCEEDED(didfail))
+ m_cfFormat=fe.cfFormat;
+ else
+ {
+ perror_OKBox(0,
+ TEXT("GetDataHere Failed"),
+ didfail);
+ }
+ return(1); // redraw (if FAILED(hr) then draw blank)
+}
+
+
+int
+CAppVars::m_SetData_SetSize(long iSizeIndex)
+{
+ FORMATETC fe;
+ HRESULT hr;
+
+ if (NULL == m_pIDataObject)
+ return 0;
+
+ SETDefFormatEtc(fe, CF_TEXT, TYMED_HGLOBAL);
+
+ m_iDataSizeIndex = iSizeIndex;
+
+ HGLOBAL hMem=GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE, sizeof(ULONG) );
+ if(NULL == hMem)
+ {
+ MessageBox(0,
+ TEXT("GlobalAlloc Return NULL"),
+ TEXT("Failure"),
+ MB_OK);
+ PostQuitMessage(0);
+ return 0;
+ }
+
+ long* pl=(long*)GlobalLock(hMem); // Lock
+ *((long*)pl) = DATASIZE_FROM_INDEX(m_iDataSizeIndex);
+ GlobalUnlock(hMem); // Unlock
+
+ m_stm.hGlobal=hMem;
+ m_stm.tymed=TYMED_HGLOBAL;
+ m_stm.pUnkForRelease=NULL;
+
+ hr = m_pIDataObject->SetData(&fe, &m_stm, FALSE); // Keep Ownership.
+ if (FAILED(hr))
+ {
+ perror_OKBox(0,
+ TEXT("SetData Failed"),
+ hr);
+ return 0;
+ }
+ return 1;;
+ // release the hMem HGLOBAL perhaps ???
+}
+
+
+int
+CAppVars::m_SetData_WithPUnk(WORD wID)
+{
+ FORMATETC fe;
+ HRESULT hr;
+
+ if(NULL == m_pIDataObject)
+ return 0;
+
+ switch(wID)
+ {
+ case IDM_OBJECTSETDATAPUNK_TEXT:
+ SETDefFormatEtc(fe, CF_TEXT, TYMED_HGLOBAL);
+ break;
+
+ /* Other cases go here.... */
+
+ default:
+ MessageBox(0,
+ TEXT("Type is Unsupported in the Client"),
+ TEXT("SetData"),
+ MB_OK);
+ return(0);
+ }
+
+ HGLOBAL hMem=GlobalAlloc( GMEM_SHARE | GMEM_MOVEABLE, sizeof(ULONG) );
+ if(NULL == hMem)
+ {
+ MessageBox(0,
+ TEXT("GlobalAlloc Return NULL"),
+ TEXT("Failure"),
+ MB_OK);
+ PostQuitMessage(0);
+ return 0;
+ }
+
+ long* pl=(long*)GlobalLock(hMem); // Lock
+ *((long*)pl) = 0xffffffff; // Use
+ GlobalUnlock(hMem); // Unlock
+
+
+ m_stm.hGlobal=hMem;
+ m_stm.tymed=TYMED_HGLOBAL;
+ hr = GetStgMedpUnkForRelease(&m_stm.pUnkForRelease);
+ if(NOERROR != hr)
+ {
+ perror_OKBox(0, TEXT("Can't get pUnk For Release"), hr);
+ }
+
+ hr = m_pIDataObject->SetData(&fe, &m_stm, TRUE); // Pass Ownership.
+ // We passed ownership so SetData took the HGLOBAL from us.
+ if (FAILED(hr))
+ {
+ perror_OKBox(0,
+ TEXT("SetData Failed"),
+ hr);
+ return 0;
+ }
+ return 1;
+}
+
+#define NUM_RUNS 5
+
+
+void
+CAppVars::m_BatchToFile()
+{
+ dataset_t dsGetDataText;
+ dataset_t dsGetDataHereText;
+
+ pm_ClearDataset(&dsGetDataText);
+ pm_ClearDataset(&dsGetDataHereText);
+
+ int iRun;
+ for(iRun=0; iRun < NUM_RUNS; iRun++)
+ {
+ m_MeasureAllSizes(IDM_OBJECTGETDATA_TEXT,
+ NULL,
+ &dsGetDataText);
+ m_MeasureAllSizes(IDM_OBJECTGETDATAHERE_TEXT,
+ NULL,
+ &dsGetDataHereText);
+ }
+
+ FILE *fp;
+ int i;
+ if(NULL == (fp = fopen(FILENAME, "w")))
+ {
+ MessageBox(0, TEXT("Cannot Open Output File"),
+ TEXT(FILENAME),
+ MB_OK | MB_ICONSTOP);
+ return;
+ }
+
+ fprintf(fp, " GetData w/ HGLOBAL GetDataHere w/ HGLOBAL\n");
+ fprintf(fp, " Size Best Worst Average Best Worst Average\n");
+ for (i=0; i<NUM_POINTS; i++)
+ {
+ fprintf(fp, "%5d\t", cKSizes[i]);
+#define PR_TIME(fp, v) (fprintf(fp, "%3lu.%03lu\t", (v)/1000, (v)%1000))
+
+ PR_TIME(fp, dsGetDataText.cBest[i]);
+ PR_TIME(fp, dsGetDataText.cWorst[i]);
+ PR_TIME(fp, dsGetDataText.cTotal[i]/NUM_RUNS);
+ PR_TIME(fp, dsGetDataHereText.cBest[i]);
+ PR_TIME(fp, dsGetDataHereText.cWorst[i]);
+ PR_TIME(fp, dsGetDataHereText.cTotal[i]/NUM_RUNS);
+ fprintf(fp, "\n");
+ }
+ fclose(fp);
+
+ MessageBox(0, TEXT("Output Written to file.dat!"),
+ TEXT("Done"), MB_OK);
+}
+
+void
+CAppVars::pm_ClearDataset(dataset_t *ds)
+{
+ int i;
+ for(i=0; i<NUM_POINTS; i++)
+ {
+ ds->cTotal[i] = 0;
+ ds->cBest[i] = 0xFFFFFFFF;
+ ds->cWorst[i] = 0;
+ }
+}
+
+
+void
+CAppVars::m_MeasureAllSizes(
+ WORD wID,
+ LPTSTR tstrTitle,
+ dataset_t *ds)
+{
+ int i;
+ ULONG cUSecs[NUM_POINTS];
+
+ // Save some state.
+ ULONG iOldDataSizeIndex = m_iDataSizeIndex;
+
+ for (i=0; i<NUM_POINTS; i++)
+ {
+ m_SetData_SetSize(cKSizes[i]);
+
+ switch(wID)
+ {
+ case IDM_OBJECTGETDATA_TEXT:
+ case IDM_OBJECTGETDATA_BITMAP:
+ m_GetData(wID);
+ break;
+
+ case IDM_OBJECTGETDATAHERE_TEXT:
+ case IDM_OBJECTGETDATAHERE_BITMAP:
+ m_GetDataHere(wID);
+ break;
+ }
+ m_swTimer.m_Read(&cUSecs[i]);
+ cUSecs[i] /= m_cIterations;
+ }
+
+ // Restore save state.
+ m_iDataSizeIndex = iOldDataSizeIndex;
+ m_SetData_SetSize(m_iDataSizeIndex);
+
+
+ // If the caller provided memory then return the data in it.
+ if(NULL != ds)
+ {
+ for (i=0; i<NUM_POINTS; i++)
+ {
+ ds->cData[i] = cUSecs[i];
+ ds->cTotal[i] += cUSecs[i];
+
+ if(ds->cBest[i] > cUSecs[i])
+ ds->cBest[i] = cUSecs[i];
+ if( ds->cWorst[i] < cUSecs[i])
+ ds->cWorst[i] = cUSecs[i];
+ }
+ }
+
+ // If the caller passed a NULL Title then no message box.
+ if(NULL == tstrTitle)
+ return;
+
+ // Render Results.
+ LPTSTR tstr = &tcMessageBuf[0];
+ for (i=0; i<NUM_POINTS; i++)
+ {
+ wsprintf(tstr, TEXT("%dK: %lu.%03lu%c"),
+ cKSizes[i], cUSecs[i]/1000, cUSecs[i]%1000,
+ (i%4==3)? TEXT('\n'):TEXT('\t') );
+ tstr += lstrlen(tstr);
+ }
+ MessageBox(0, tcMessageBuf, tstrTitle, MB_OK);
+}
+
+
+
+void
+CAppVars::m_SetMeasurement(WORD wID)
+{
+ HMENU hMenu=GetMenu(m_hWnd);
+ switch (wID)
+ {
+ case IDM_MEASUREMENT_ON:
+ m_fDisplayTime = TRUE;
+ CheckMenuItem(hMenu, IDM_MEASUREMENT_ON, MF_CHECKED);
+ CheckMenuItem(hMenu, IDM_MEASUREMENT_OFF, MF_UNCHECKED);
+ break;
+
+ case IDM_MEASUREMENT_OFF:
+ m_fDisplayTime = FALSE;
+ CheckMenuItem(hMenu, IDM_MEASUREMENT_ON, MF_UNCHECKED);
+ CheckMenuItem(hMenu, IDM_MEASUREMENT_OFF, MF_CHECKED);
+ break;
+
+
+ case IDM_MEASUREMENT_1:
+ m_cIterations = 1;
+ goto set_menu;
+ case IDM_MEASUREMENT_50:
+ m_cIterations = 50;
+ goto set_menu;
+ case IDM_MEASUREMENT_300:
+ m_cIterations = 300;
+ goto set_menu;
+set_menu:
+ CheckMenuItem(hMenu, IDM_MEASUREMENT_1, MF_UNCHECKED);
+ CheckMenuItem(hMenu, IDM_MEASUREMENT_50, MF_UNCHECKED);
+ CheckMenuItem(hMenu, IDM_MEASUREMENT_300, MF_UNCHECKED);
+ CheckMenuItem(hMenu, wID, MF_CHECKED);
+ break;
+
+
+ case IDM_MEASUREMENT_TEST:
+ m_swTimer.m_Start();
+ m_swTimer.m_Sleep(777);
+ m_swTimer.m_Stop();
+ m_DisplayTimerResults();
+ break;
+ }
+}
+
+void
+CAppVars::m_DisplayTimerResults()
+{
+ ULONG usecs;
+ m_swTimer.m_Read(&usecs);
+ usecs /= m_cIterations;
+ wprintf_OKBox(0, TEXT("MilliSeconds"),
+ TEXT("%lu.%03lu"),
+ usecs/1000, usecs%1000);
+}
+
+
+/*
+ * CAppVars::Paint
+ *
+ * Purpose:
+ * Handles WM_PAINT for the main window by drawing whatever
+ * data we have sitting in the STGMEDIUM at this time.
+ *
+ * Parameters:
+ * None
+ *
+ * Return Value:
+ * None
+ */
+
+void CAppVars::Paint(void)
+ {
+ PAINTSTRUCT ps;
+ HDC hDC;
+#ifdef NOT_SIMPLE
+ HDC hMemDC;
+ LPMETAFILEPICT pMF;
+#endif /* NOT_SIMPLE */
+ LPTSTR psz;
+ RECT rc;
+ FORMATETC fe;
+
+ GetClientRect(m_hWnd, &rc);
+
+ hDC=BeginPaint(m_hWnd, &ps);
+
+ //May need to retrieve the data with EXE objects
+#ifdef NOT_SIMPLE
+ if (m_fEXE)
+ {
+ if (TYMED_NULL==m_stm.tymed && 0!=m_cfFormat)
+ {
+ SETDefFormatEtc(fe, m_cfFormat, TYMED_HGLOBAL
+ | TYMED_MFPICT | TYMED_GDI);
+
+ if (NULL!=m_pIDataObject)
+ m_pIDataObject->GetData(&fe, &m_stm);
+ }
+ }
+#endif /* NOT_SIMPLE */
+
+ switch (m_cfFormat)
+ {
+ case CF_TEXT:
+ psz=(LPTSTR)GlobalLock(m_stm.hGlobal);
+
+ if (NULL==psz)
+ break;
+
+ SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
+ SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
+
+ pm_DrawText(hDC, psz, &rc, DT_LEFT | DT_WORDBREAK);
+
+ GlobalUnlock(m_stm.hGlobal);
+ break;
+
+#ifdef NOT_SIMPLE
+ case CF_BITMAP:
+ hMemDC=CreateCompatibleDC(hDC);
+
+ if (NULL!=SelectObject(hMemDC, (HGDIOBJ)m_stm.hGlobal))
+ {
+ BitBlt(hDC, 0, 0, rc.right-rc.left, rc.bottom-rc.top
+ , hMemDC, 0, 0, SRCCOPY);
+ }
+
+ DeleteDC(hMemDC);
+ break;
+
+ case CF_METAFILEPICT:
+ pMF=(LPMETAFILEPICT)GlobalLock(m_stm.hGlobal);
+
+ if (NULL==pMF)
+ break;
+
+ SetMapMode(hDC, pMF->mm);
+ SetWindowOrgEx(hDC, 0, 0, NULL);
+ SetWindowExtEx(hDC, pMF->xExt, pMF->yExt, NULL);
+
+ SetViewportExtEx(hDC, rc.right-rc.left
+ , rc.bottom-rc.top, NULL);
+
+ PlayMetaFile(hDC, pMF->hMF);
+ GlobalUnlock(m_stm.hGlobal);
+ break;
+
+#else /* IS SIMPLE */
+ case CF_BITMAP:
+ case CF_METAFILEPICT:
+ DebugBreak();
+ break;
+
+#endif /* NOT_SIMPLE */
+
+ default:
+ break;
+ }
+
+ EndPaint(m_hWnd, &ps);
+ return;
+ }
+
+
+void
+CAppVars::pm_DrawText(
+ HDC hDC,
+ LPTSTR psz,
+ RECT* prc,
+ UINT flags)
+{
+ SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
+ SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
+
+// If we are WIN32 and the server is 16 bits this must be ASCII.
+#ifdef WIN32
+ if(m_f16Bit)
+ DrawTextA(hDC, (char*)psz, -1, prc, flags);
+ else
+#endif
+ DrawText(hDC, psz, -1, prc, flags);
+}
diff --git a/private/oleutest/perf16/idata/client/datausr.h b/private/oleutest/perf16/idata/client/datausr.h
new file mode 100644
index 000000000..aa3f5f0a9
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/datausr.h
@@ -0,0 +1,226 @@
+/*
+ * DATAUSER.H
+ * Data Object User Chapter 6
+ *
+ * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
+ *
+ * Kraig Brockschmidt, Software Design Engineer
+ * Microsoft Systems Developer Relations
+ *
+ * Internet : kraigb@microsoft.com
+ * Compuserve: >INTERNET:kraigb@microsoft.com
+ */
+
+
+#ifndef _DATAUSER_H_
+#define _DATAUSER_H_
+
+#include "../syshead.h"
+#include "../my3216.h"
+#include "../bookpart.h"
+#include "stpwatch.h"
+
+
+//Menu Resource ID and Commands
+#define IDR_MENU 1
+
+
+// #define IDM_OBJECTUSEDLL 100
+// #define IDM_OBJECTUSEEXE 101
+// #define IDM_OBJECTDATASIZESMALL 102
+// #define IDM_OBJECTDATASIZEMEDIUM 103
+// #define IDM_OBJECTDATASIZELARGE 104
+#define IDM_OBJECTQUERYGETDATA 105
+#define IDM_OBJECTGETDATA_TEXT 106
+#define IDM_OBJECTGETDATA_BITMAP 107
+// #define IDM_OBJECTGETDATA_METAFILEPICT 108
+#define IDM_OBJECTEXIT 109
+
+#define IDM_OBJECTGETDATAHERE_TEXT 110
+#define IDM_OBJECTGETDATAHERE_BITMAP 111
+#define IDM_OBJECTGETDATAHERE_NULLTEXT 112
+#define IDM_OBJECTGETDATAHERE_NULLBITMAP 113
+
+#define IDM_USE16BITSERVER 120
+#define IDM_USE32BITSERVER 121
+
+#define IDM_OBJECTGETCANON 122
+
+// Reserve Range..
+#define IDM_OBJECTSETDATA 400
+// ....
+// reserved through 464
+
+#define IDM_OBJECTSETDATAPUNK_TEXT 500
+#define IDM_OBJECTSETDATAPUNK_BITMAP 501
+
+
+#define IDM_MEASUREMENT_1 140
+#define IDM_MEASUREMENT_50 141
+#define IDM_MEASUREMENT_300 142
+
+#define IDM_MEASUREMENT_OFF 145
+#define IDM_MEASUREMENT_ON 146
+#define IDM_MEASUREMENT_TEST 147
+
+#define IDM_BATCHTOFILE 150
+#define IDM_BATCH_GETDATA 151
+#define IDM_BATCH_GETDATAHERE 152
+
+// #define IDM_ADVISEMIN 200
+// #define IDM_ADVISETEXT (IDM_ADVISEMIN+CF_TEXT)
+// #define IDM_ADVISEBITMAP (IDM_ADVISEMIN+CF_BITMAP)
+// #define IDM_ADVISEMETAFILEPICT (IDM_ADVISEMIN+CF_METAFILEPICT)
+// #define IDM_ADVISEGETDATA 300
+// #define IDM_ADVISEREPAINT 301
+
+
+#ifdef WIN32
+ #define API_ENTRY APIENTRY
+#else
+ #define API_ENTRY FAR PASCAL _export
+#endif
+
+//DATAUSER.CPP
+LRESULT API_ENTRY DataUserWndProc(HWND, UINT, WPARAM, LPARAM);
+
+
+class CImpIAdviseSink;
+typedef class CImpIAdviseSink *PIMPIADVISESINK;
+
+
+
+#define FILENAME "time.dat"
+#define NUM_POINTS 15
+
+typedef struct {
+ ULONG cData[NUM_POINTS];
+ ULONG cBest[NUM_POINTS];
+ ULONG cWorst[NUM_POINTS];
+ ULONG cTotal[NUM_POINTS];
+} dataset_t;
+
+
+
+
+/*
+ * Application-defined classes and types.
+ */
+
+class CAppVars
+ {
+ friend LRESULT API_ENTRY DataUserWndProc(HWND, UINT, WPARAM, LPARAM);
+
+ friend class CImpIAdviseSink;
+
+ protected:
+ HINSTANCE m_hInst; //WinMain parameters
+ HINSTANCE m_hInstPrev;
+ UINT m_nCmdShow;
+
+ HWND m_hWnd; //Main window handle
+// BOOL m_fEXE; //For tracking menu
+
+// PIMPIADVISESINK m_pIAdviseSink; //Our CImpIAdviseSink
+// DWORD m_dwConn; //Advise connection
+// UINT m_cfAdvise; //Advise format
+// BOOL m_fGetData; //GetData on data change?
+// BOOL m_fRepaint; //Repaint on data change?
+
+// LPDATAOBJECT m_pIDataSmall;
+// LPDATAOBJECT m_pIDataMedium;
+// LPDATAOBJECT m_pIDataLarge;
+
+ LPDATAOBJECT m_pIDataObject; //Current selection
+ UINT m_f16Bit;
+ UINT m_cfFormat;
+ STGMEDIUM m_stm; //Current rendering
+
+ BOOL m_fInitialized; //Did CoInitialize work?
+
+ ULONG m_iDataSizeIndex;
+ HGLOBAL m_hgHereBuffers[64];
+ BOOL m_fDisplayTime;
+ LONG m_cIterations;
+ StopWatch_cl m_swTimer;
+
+ int m_HereAllocCount; // For debugging.
+
+ public:
+ CAppVars(HINSTANCE, HINSTANCE, UINT);
+ ~CAppVars(void);
+ BOOL FInit(void);
+ BOOL FReloadDataObjects(BOOL);
+ void TryQueryGetData(LPFORMATETC, UINT, BOOL, UINT);
+ void Paint(void);
+
+ int m_GetDataHere(WORD wID);
+ int m_GetData(WORD wID);
+ int m_SetData_SetSize(long iSizeIndex);
+ int m_SetData_WithPUnk(WORD wID);
+ void m_SetMeasurement(WORD wID);
+ void m_MeasureAllSizes(WORD wID, LPTSTR title, dataset_t *);
+
+ void m_BatchToFile();
+ void m_DisplayTimerResults();
+
+ private:
+ void pm_DrawText(HDC hDc, LPTSTR psz, RECT* prc, UINT flags);
+ void pm_ClearDataset(dataset_t *);
+
+ };
+
+
+typedef CAppVars *PAPPVARS;
+
+#define CBWNDEXTRA sizeof(PAPPVARS)
+#define DATAUSERWL_STRUCTURE 0
+
+
+//This lives with the app to get OnDataChange notifications.
+
+class CImpIAdviseSink : public IAdviseSink
+ {
+ protected:
+ ULONG m_cRef;
+ PAPPVARS m_pAV;
+
+ public:
+ CImpIAdviseSink(PAPPVARS);
+ ~CImpIAdviseSink(void);
+
+ STDMETHODIMP QueryInterface(REFIID, PPVOID);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+
+ //We only implement OnDataChange for now.
+ STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM);
+ STDMETHODIMP_(void) OnViewChange(DWORD, LONG);
+ STDMETHODIMP_(void) OnRename(LPMONIKER);
+ STDMETHODIMP_(void) OnSave(void);
+ STDMETHODIMP_(void) OnClose(void);
+ };
+
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Storage Medium IUnknown interface for pUnkForRelease.
+//
+
+class CStgMedIf: public IUnknown {
+private:
+ ULONG m_cRef;
+public:
+ CStgMedIf();
+ STDMETHODIMP QueryInterface(REFIID, PPVOID);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+};
+
+//////////////////////////
+// API for getting a pUnkForRelease.
+//
+
+HRESULT GetStgMedpUnkForRelease(IUnknown **pp_unk);
+
+#endif //_DATAUSER_H_
diff --git a/private/oleutest/perf16/idata/client/datausr.ico b/private/oleutest/perf16/idata/client/datausr.ico
new file mode 100644
index 000000000..0c2fa257f
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/datausr.ico
Binary files differ
diff --git a/private/oleutest/perf16/idata/client/idatausr.def b/private/oleutest/perf16/idata/client/idatausr.def
new file mode 100644
index 000000000..1ba2162d8
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/idatausr.def
@@ -0,0 +1,9 @@
+NAME DATAUSER
+DESCRIPTION 'Data Object User Chapter 6 (c)1993 Microsoft Corp.'
+EXETYPE WINDOWS
+STUB 'WINSTUB.EXE'
+CODE PRELOAD MOVEABLE DISCARDABLE
+DATA PRELOAD MOVEABLE MULTIPLE
+
+HEAPSIZE 2048
+STACKSIZE 4096
diff --git a/private/oleutest/perf16/idata/client/idatausr.rc b/private/oleutest/perf16/idata/client/idatausr.rc
new file mode 100644
index 000000000..2d95453f4
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/idatausr.rc
@@ -0,0 +1,120 @@
+/*
+ * DATAUSER.RC
+ * Data Object User Chapter 6
+ *
+ * Resource definitions
+ *
+ * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
+ *
+ * Kraig Brockschmidt, Software Design Engineer
+ * Microsoft Systems Developer Relations
+ *
+ * Internet : kraigb@microsoft.com
+ * Compuserve: >INTERNET:kraigb@microsoft.com
+ */
+
+
+#include <windows.h>
+#include "datausr.h"
+
+
+Icon ICON "datausr.ico"
+
+
+IDR_MENU MENU MOVEABLE DISCARDABLE
+ BEGIN
+ POPUP "&Server"
+ BEGIN
+ MENUITEM "Use 16 bit server" IDM_USE16BITSERVER
+ MENUITEM "Use 32 bit server" IDM_USE32BITSERVER
+ MENUITEM SEPARATOR
+ MENUITEM "&Exit", IDM_OBJECTEXIT
+ END
+ POPUP "&IDataObject::"
+ BEGIN
+/*
+ MENUITEM "Use &DLL Object", IDM_OBJECTUSEDLL
+ MENUITEM "Use &EXE Object", IDM_OBJECTUSEEXE
+ MENUITEM SEPARATOR
+ POPUP "Data &Size"
+ BEGIN
+ MENUITEM "&Small", IDM_OBJECTDATASIZESMALL
+ MENUITEM "&Medium", IDM_OBJECTDATASIZEMEDIUM
+ MENUITEM "&Large", IDM_OBJECTDATASIZELARGE
+ END
+ */
+ POPUP "&GetData"
+ BEGIN
+ MENUITEM "&1 CF_TEXT", IDM_OBJECTGETDATA_TEXT
+ MENUITEM "&2 CF_BITMAP", IDM_OBJECTGETDATA_BITMAP
+/*
+ MENUITEM "&3 CF_METAFILEPICT", IDM_OBJECTGETDATA_METAFILEPICT
+ */
+ END
+ POPUP "GetData&Here"
+ BEGIN
+ MENUITEM "&1 CF_TEXT", IDM_OBJECTGETDATAHERE_TEXT
+ MENUITEM "&2 CF_BITMAP", IDM_OBJECTGETDATAHERE_BITMAP
+ END
+ POPUP "GetDataHere w/&Null"
+ BEGIN
+ MENUITEM "&1 CF_TEXT", IDM_OBJECTGETDATAHERE_NULLTEXT
+ MENUITEM "&2 CF_BITMAP", IDM_OBJECTGETDATAHERE_NULLBITMAP
+ END
+ MENUITEM "&QueryGetData", IDM_OBJECTQUERYGETDATA
+/*
+ MENUITEM "Get&CanonicalFormatEtc", IDM_OBJECTGETCANON
+*/
+ POPUP "(&Set Size)",
+ BEGIN
+ MENUITEM " 1K bytes" IDM_OBJECTSETDATA+1
+ MENUITEM " 2K bytes" IDM_OBJECTSETDATA+2
+ MENUITEM " 4K bytes" IDM_OBJECTSETDATA+4
+ MENUITEM " 8K bytes" IDM_OBJECTSETDATA+8
+ MENUITEM "12K bytes" IDM_OBJECTSETDATA+12
+ MENUITEM "14K bytes" IDM_OBJECTSETDATA+14
+ MENUITEM "16K bytes" IDM_OBJECTSETDATA+16
+ MENUITEM "20K bytes" IDM_OBJECTSETDATA+20
+ MENUITEM "24K bytes" IDM_OBJECTSETDATA+24
+ MENUITEM "28K bytes" IDM_OBJECTSETDATA+28
+ MENUITEM "32K bytes" IDM_OBJECTSETDATA+32
+ MENUITEM "40K bytes" IDM_OBJECTSETDATA+40
+ MENUITEM "48K bytes" IDM_OBJECTSETDATA+48
+ MENUITEM "56K bytes" IDM_OBJECTSETDATA+56
+ END
+ POPUP "SetData w/&pUnk",
+ BEGIN
+ MENUITEM "&1 CF_TEXT", IDM_OBJECTSETDATAPUNK_TEXT
+ MENUITEM "&2 CF_BITMAP", IDM_OBJECTSETDATAPUNK_BITMAP
+ END
+ END
+ POPUP "&Measurement"
+ BEGIN
+ MENUITEM "&1 Call", IDM_MEASUREMENT_1
+ MENUITEM "&50 Calls" IDM_MEASUREMENT_50
+ Menuitem "&300 Calls" IDM_MEASUREMENT_300
+ MENUITEM SEPARATOR
+ MENUITEM "Display Time O&n" IDM_MEASUREMENT_ON
+ MENUITEM "Display Time O&ff" IDM_MEASUREMENT_OFF
+ MENUITEM SEPARATOR
+ POPUP "&Batch Measurement"
+ BEGIN
+ MENUITEM "&GetData" IDM_BATCH_GETDATA
+ MENUITEM "GetData&Here" IDM_BATCH_GETDATAHERE
+ END
+ MENUITEM "Batch &To File" IDM_BATCHTOFILE
+ MENUITEM SEPARATOR
+ MENUITEM "&Test Timer" IDM_MEASUREMENT_TEST
+ END
+/*
+ POPUP "&Advise"
+ BEGIN
+ MENUITEM "&1 CF_TEXT", IDM_ADVISETEXT
+ MENUITEM "&2 CF_BITMAP", IDM_ADVISEBITMAP
+ MENUITEM "&3 CF_METAFILEPICT", IDM_ADVISEMETAFILEPICT
+ MENUITEM SEPARATOR
+ MENUITEM "&GetData on Change", IDM_ADVISEGETDATA
+ MENUITEM "&Paint on Change", IDM_ADVISEREPAINT
+ END
+ */
+ END
diff --git a/private/oleutest/perf16/idata/client/make16.inc b/private/oleutest/perf16/idata/client/make16.inc
new file mode 100644
index 000000000..ec6d94d20
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/make16.inc
@@ -0,0 +1,331 @@
+# 16-bit makefile
+#
+# Copyright (c) 1991, Microsoft Corporation
+#
+# History:
+#
+# 18-Feb-1994 KevinRo
+# 24-Feb-1994 DrewB, added OBJDIR and some other niceties from win40.mk
+#
+
+.SUFFIXES:
+.SUFFIXES: .c .cxx .cpp .asm .h .inc .obj .lst
+.SUFFIXES: .sys .exe .com .map .sym .def .lib .rc .res
+
+!if "$(TARGET)" == ""
+!error TARGET must be defined
+!endif
+
+OUTNUL= 1>nul 2>nul
+
+!if "$(NTDEBUG)" != "" && "$(NTDEBUG)" != "retail"
+OBJDIR = obj16d
+!else
+OBJDIR = obj16r
+!endif
+
+# Build up lists of files to produce from sources
+
+!if "$(CFILES)" != ""
+OBJFILES = $(OBJFILES) $(CFILES:.c=.obj)
+!endif
+!if "$(CXXFILES)" != ""
+OBJFILES = $(OBJFILES) $(CXXFILES:.cxx=.obj)
+!endif
+!if "$(CPPFILES)" != ""
+OBJFILES = $(OBJFILES) $(CPPFILES:.cpp=.obj)
+!endif
+
+!if "$(ASMFILES)" != ""
+OBJFILES = $(OBJFILES) $(ASMFILES:.asm=.obj)
+!endif
+
+!if "$(RCFILES)" != ""
+RESFILES = $(RCFILES:.rc=.res)
+!endif
+
+# Replace .\ with $(OBJDIR)
+# Unfortunately we can't do this directly so we have to explicitly check
+# the value of OBJDIR
+
+!if "$(OBJDIR)" == "obj16d"
+OBJFILES = $(OBJFILES:.\=obj16d\)
+RESFILES = $(RESFILES:.\=obj16d\)
+
+!elseif "$(OBJDIR)" == "obj16r"
+OBJFILES = $(OBJFILES:.\=obj16r\)
+RESFILES = $(RESFILES:.\=obj16r\)
+
+!else
+!error Unknown OBJDIR: $(OBJDIR)
+!endif
+
+# Default target
+
+all: $(OBJDIR)\$(TARGET)
+
+# Determine target type and base name
+
+# Is it a DLL?
+TARGETBASE=$(TARGET:.dll=)
+!if "$(TARGETBASE)" != "$(TARGET)"
+TARGETTYPE=dll
+!else
+
+# Is it an EXE?
+TARGETBASE=$(TARGET:.exe=)
+! if "$(TARGETBASE)" != "$(TARGET)"
+TARGETTYPE=exe
+! else
+
+# Is it a LIB?
+TARGETBASE=$(TARGET:.lib=)
+! if "$(TARGETBASE)" != "$(TARGET)"
+TARGETTYPE=lib
+! endif
+! endif
+!endif
+
+!if "$(TARGETTYPE)" == ""
+!error Unknown target type for "$(TARGET)"
+!endif
+
+!if "$(BUILDDETAILS)" != ""
+BLDKEEP= KEEP
+!endif
+
+OLETHUNK= $(_NTDRIVE)$(_NTROOT)\private\ole32\olethunk
+OLE16= $(OLETHUNK)\ole16
+
+RCINC = $(RCINC) -i$(OLE16)\inc
+INCS = -I$(OLE16)\inc -I$(OLETHUNK)\h -I$(_NTDRIVE)$(_NTROOT)\private\cinc
+
+
+PATH = $(OLE16)\tools;$(PATH)
+LINK = link16
+RC = rc16
+CL = cl16
+IMPLIB = implib
+LIBUTIL = lib16
+MAPSYM = mapsym
+MASM = masm
+
+DEFINES = -DWOW
+
+AOBJ = -Mx -t $(DEFINES) $(INCS)
+
+!if "$(TARGETTYPE)" == "exe"
+CW16 = -GA
+!else
+CW16 = -GD
+DEFINES = $(DEFINES) -D_WINDLL
+!endif
+
+CW16 = $(CW16) -G2 -AL $(DEFINES) $(INCS) /NMSEG_CODE
+
+LFLAGS = $(LFLAGS) /nod /noe /map:0 /align:16
+
+!if "$(NTDEBUG)" != "" && "$(NTDEBUG)" != "retail"
+
+DEFINES = $(DEFINES) -DDBG=1 -DDEVL=1
+
+!if "$(NTDEBUGTYPE)" == "windbg"
+AOBJ = $(AOBJ) -Zi
+CW16 = $(CW16) /Odi /Zip /FA
+LFLAGS = $(LFLAGS) /CO
+!else
+AOBJ = $(AOBJ) -Zd
+CW16 = $(CW16) /Odi /Zd
+LFLAGS = $(LFLAGS) /LI
+!endif
+
+!else
+CW16 = $(CW16) /Os /Zp /Gs
+DEFINES = $(DEFINES) -DDBG=0 -DDEVL=1
+!endif
+
+!if "$(TARGETTYPE)" == "dll"
+W16LIBS = $(OLE16)\lib\ldllcew.lib
+!else
+!if "$(QUICKWINDOWS)" != ""
+W16LIBS = $(OLE16)\lib\llibcewq.lib
+!else
+W16LIBS = $(OLE16)\lib\llibcew.lib
+!endif
+!endif
+
+W16LIBS = $(W16LIBS) $(OLE16)\lib\libw.lib
+
+!if "$(TARGETTYPE)" == "dll" || "$(TARGETTYPE)" == "exe"
+LIBS = $(LIBS) $(W16LIBS)
+!endif
+
+.asm{$(OBJDIR)}.obj:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(MASM) $(AOBJ) $*,$*;
+
+.asm.lst:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(MASM) $(AOBJ) -l $*,nul,$*.lst;
+
+
+.c{$(OBJDIR)}.obj:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$*.rsp
+$(CW16: =
+)
+-Fo$*.obj
+$<
+<<$(BLDKEEP)
+
+.c.lst:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
+$(CW16: =
+)
+-Fonul
+-Fc$*.lst
+$<
+<<$(BLDKEEP)
+
+.cxx{$(OBJDIR)}.obj:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$*.rsp
+$(CW16: =
+)
+-Fo$*.obj
+-Tp$<
+<<$(BLDKEEP)
+
+.cxx.lst:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
+$(CW16: =
+)
+-Fc$*.lst
+-Fonul
+-Tp$<
+<<$(BLDKEEP)
+
+.cxx.pp:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp > $*.pp
+$(CW16: =
+)
+-E
+-Fonul
+-Tp$<
+<<$(BLDKEEP)
+
+
+.cpp{$(OBJDIR)}.obj:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$*.rsp
+$(CW16: =
+)
+-Fo$*.obj
+-Tp$<
+<<$(BLDKEEP)
+
+.cpp.lst:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp
+$(CW16: =
+)
+-Fc$*.lst
+-Fonul
+-Tp$<
+<<$(BLDKEEP)
+
+.cpp.pp:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(CL) -c -nologo @<<$(OBJDIR)\$*.rsp > $*.pp
+$(CW16: =
+)
+-E
+-Fonul
+-Tp$<
+<<$(BLDKEEP)
+
+
+.def{$(OBJDIR)}.lib:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(IMPLIB) $*.lib $<
+
+{$(OBJDIR)}.map{$(OBJDIR)}.sym:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(MAPSYM) $<
+
+.rc{$(OBJDIR)}.res:
+ @-md $(OBJDIR) $(OUTNUL)
+ $(RC) -r $(RCINC) -fo $*.res $<
+
+
+cleanup:
+ if exist $(OBJDIR)\*.lrf del $(OBJDIR)\*.lrf
+ if exist $(OBJDIR)\*.obj del $(OBJDIR)\*.obj
+ if exist $(OBJDIR)\*.exe del $(OBJDIR)\*.exe
+ if exist $(OBJDIR)\*.map del $(OBJDIR)\*.map
+ if exist $(OBJDIR)\*.sym del $(OBJDIR)\*.sym
+ if exist $(OBJDIR)\*.res del $(OBJDIR)\*.res
+
+clean: cleanup
+
+!if "$(TARGETTYPE)" == "dll"
+
+$(OBJDIR)\$(TARGETBASE).lib: $(TARGETBASE).def
+
+$(OBJDIR)\$(TARGET) $(OBJDIR)\$(TARGETBASE).map: $(OBJFILES) $(RESFILES) \
+ $(TARGETBASE).def $(OBJDIR)\$(TARGETBASE).lib $(LIBS)
+ @-md $(OBJDIR) $(OUTNUL)
+ $(LINK) $(LFLAGS) @<<$(OBJDIR)\$(TARGETBASE).rsp
+$(OBJFILES: =+^
+)
+$(OBJDIR)\$(TARGET)
+$(OBJDIR)\$(TARGETBASE).map
+$(LIBS: =+^
+)
+$(TARGETBASE).def
+<<$(BLDKEEP)
+ $(MAPSYM) -o $(OBJDIR)\$(TARGETBASE).sym $(OBJDIR)\$(TARGETBASE).map
+!if "$(RCFILES)" != ""
+ $(RC) -t $(OBJDIR)\$(TARGETBASE).res $(OBJDIR)\$(TARGET)
+!endif
+
+!elseif "$(TARGETTYPE)" == "lib"
+
+$(OBJDIR)\$(TARGET): $(OBJFILES) $(LIBS)
+ @-md $(OBJDIR) $(OUTNUL)
+ -del $@ $(OUTNUL)
+ $(LIBUTIL) @<<$*.lnb
+$(OBJDIR)\$(TARGET)
+y
+$(OBJFILES: = &^
+)&
+$(LIBS: = &^
+)&
+
+$*.lls
+<<$(BLDKEEP)
+
+!elseif "$(TARGETTYPE)" == "exe"
+
+$(OBJDIR)\$(TARGET) $(OBJDIR)\$(TARGETBASE).map: $(OBJFILES) $(RESFILES) \
+ $(TARGETBASE).def $(LIBS)
+ @-md $(OBJDIR) $(OUTNUL)
+ $(LINK) $(LFLAGS) @<<$(OBJDIR)\$(TARGETBASE).rsp
+$(OBJFILES: =+^
+)
+$(OBJDIR)\$(TARGET)
+$(OBJDIR)\$(TARGETBASE).map
+$(LIBS: =+^
+)
+$(TARGETBASE).def
+<<$(BLDKEEP)
+!if "$(RCFILES)" != ""
+ $(RC) -t $(OBJDIR)\$(TARGETBASE).res $(OBJDIR)\$(TARGET)
+!endif
+ $(MAPSYM) -o $(OBJDIR)\$(TARGETBASE).sym $(OBJDIR)\$(TARGETBASE).map
+
+!endif
+ \ No newline at end of file
diff --git a/private/oleutest/perf16/idata/client/make16.mak b/private/oleutest/perf16/idata/client/make16.mak
new file mode 100644
index 000000000..f569e11e3
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/make16.mak
@@ -0,0 +1,58 @@
+#//+---------------------------------------------------------------------------
+#//
+#// Microsoft Windows
+#// Copyright (C) Microsoft Corporation, 1992 - 1994.
+#//
+#// File: make16.mak
+#// Contents: make16.mak for 16 bit compile of idata test
+#//
+#// History: 06-21-95 Chapman Created
+#//
+#//----------------------------------------------------------------------------
+
+NTDEBUG=1
+
+
+default: copy_bin
+
+TARGET = idatausr.exe
+TARGETTYPE = EXE
+OLETHUNK = $(_NTDRIVE)$(_NTROOT)\private\ole32\olethunk
+
+RCINC=$(RCINC) -i..\ole2ui -i..\ole2ui\res\usa
+
+# CDEFINES= -I..\ole2ui /GEs -I..
+
+
+LFLAGS=/STACK:16384
+
+CPPFILES = \
+ .\datausr.cpp \
+ .\perror.cpp \
+ .\stgmedif.cpp \
+ .\stpwatch.cpp
+
+RCFILES = .\idatausr.rc
+
+LIBS = $(LIBS)\
+ $(OLE16)\lib\ole2.lib \
+ $(OLE16)\lib\storage.lib \
+ $(OLE16)\lib\loleuic.lib \
+ $(OLE16)\lib\compobj.lib \
+ $(OLE16)\lib\shell.lib
+
+!include make16.inc
+
+
+!if "$(NTDEBUG)" != "" && "$(NTDEBUG)" != "retail"
+LIBS = $(LIBS) $(OLETHUNK)\debnot\$(OBJDIR)\debnot.lib
+!endif
+
+
+copy_bin: all
+ copy $(OBJDIR)\idatausr.exe $(OBJDIR)\idatau16.exe
+ copy $(OBJDIR)\idatausr.sym $(OBJDIR)\idatau16.sym
+ copy $(OBJDIR)\idatausr.map $(OBJDIR)\idatau16.map
+ binplace $(OBJDIR)\idatau16.exe
+
+
diff --git a/private/oleutest/perf16/idata/client/makefile b/private/oleutest/perf16/idata/client/makefile
new file mode 100644
index 000000000..1d3728d41
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/makefile
@@ -0,0 +1,10 @@
+############################################################################
+#
+# Copyright (C) 1992, Microsoft Corporation.
+#
+# All rights reserved.
+#
+############################################################################
+
+!include $(NTMAKEENV)\makefile.def
+
diff --git a/private/oleutest/perf16/idata/client/perror.cpp b/private/oleutest/perf16/idata/client/perror.cpp
new file mode 100644
index 000000000..5feec3560
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/perror.cpp
@@ -0,0 +1,76 @@
+// This is functions used by both the
+// the client and the server programs
+
+#include <windows.h>
+#include <ole2.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include "perror.h"
+
+LPTSTR
+winErrorString(
+ HRESULT hrErrorCode,
+ LPTSTR sBuf,
+ int cBufSize)
+{
+#ifdef WIN32
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ hrErrorCode,
+ GetSystemDefaultLangID(),
+ sBuf,
+ cBufSize,
+ NULL);
+#else
+ wsprintf(sBuf, "\"0x%08x\"\n", hrErrorCode);
+#endif // WIN32
+ return sBuf;
+}
+
+#define PBUF_LEN 200
+
+#if 0 // I'm not linking with "printf" currently.
+void
+print_error(
+ LPTSTR sMessage,
+ HRESULT hrErrorCode)
+{
+ TCHAR sBuf[PBUF_LEN];
+
+ winErrorString(hrErrorCode, sMessage, PBUF_LEN);
+#ifdef WIN32
+ printf("%s(0x%x)%s", sMessage, hrErrorCode, sBuf);
+#else
+ printf("%s%s", sMessage, sBuf);
+#endif
+}
+#endif
+
+void
+perror_OKBox(
+ HWND hwnd,
+ LPTSTR sTitle,
+ HRESULT hrErrorCode)
+{
+ TCHAR sBuf[PBUF_LEN];
+ TCHAR sBuf2[PBUF_LEN];
+
+ winErrorString(hrErrorCode, sBuf, PBUF_LEN);
+ wsprintf(sBuf2, TEXT("%s(%08x)"), sBuf, hrErrorCode);
+ MessageBox(hwnd, sBuf2, sTitle, MB_OK);
+}
+
+void
+wprintf_OKBox(
+ HWND hwnd,
+ LPTSTR sTitle,
+ LPTSTR sFormat,
+ ...)
+{
+ TCHAR sBuf[PBUF_LEN];
+ va_list vaMarker;
+
+ va_start( vaMarker, sFormat );
+ wvsprintf(sBuf, sFormat, vaMarker);
+ MessageBox(hwnd, sBuf, sTitle, MB_OK);
+}
diff --git a/private/oleutest/perf16/idata/client/perror.h b/private/oleutest/perf16/idata/client/perror.h
new file mode 100644
index 000000000..3eceb4b69
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/perror.h
@@ -0,0 +1,36 @@
+#include "../my3216.h"
+
+/*
+ * winErrorString: Write the text of an HRESULT into a supplied buffer.
+ */
+LPTSTR
+winErrorString(
+ HRESULT hrErrorCode,
+ LPTSTR sBuf,
+ int cBufSize);
+
+/*
+ * print_error: Print a mesage and the text of an HRESULT .
+ */
+void
+print_error(
+ LPTSTR sMessage,
+ HRESULT hrErrorCode);
+
+/*
+ * perror_OKBox: Write the text of an HRESULT in a MessageBox.
+ */
+void
+perror_OKBox(
+ HWND hwnd,
+ LPTSTR sTitle,
+ HRESULT hrErrorCode);
+/*
+ * wprintf_OKBox: printf into a MessageBox.
+ */
+void
+wprintf_OKBox(
+ HWND hwnd,
+ LPTSTR sTitle,
+ LPTSTR sFormat,
+ ...);
diff --git a/private/oleutest/perf16/idata/client/sources b/private/oleutest/perf16/idata/client/sources
new file mode 100644
index 000000000..3d3c8e356
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/sources
@@ -0,0 +1,85 @@
+!IF 0
+
+Copyright (c) 1989 Microsoft Corporation
+
+Module Name:
+
+ sources.
+
+Abstract:
+
+ This file specifies the target component being built and the list of
+ sources files needed to build that component. Also specifies optional
+ compiler switches and libraries that are unique for the component being
+ built.
+
+Author:
+
+ Brian Chapman (BChapman) July 10th 1995.
+
+!ENDIF
+
+MAJORCOMP = cairole
+MINORCOMP = perform
+
+#
+# This is the name of the target built from the source files specified
+# below. The name should include neither the path nor the file extension.
+#
+
+TARGETNAME= idatausr
+
+#
+# This specifies where the target is to be built. A private target of
+# type LIBRARY or DYNLINK should go to obj, whereas a public target of
+# type LIBRARY or DYNLINK should go to $(BASEDIR)\public\sdk\lib.
+#
+
+TARGETPATH= obj
+
+#
+# This specifies the type of the target, such as PROGRAM, DYNLINK, LIBRARY,
+# etc.
+#
+
+TARGETTYPE= PROGRAM
+
+# INCLUDES= $(BASEDIR)\private\ole32\h;..\..\common
+# INCLUDES= $(INCLUDES);$(BASEDIR)\private\oleutest\balls\oleprx32\daytona
+# INCLUDES= $(INCLUDES);$(BASEDIR)\private\ole32\common\daytona;..
+# INCLUDES= $(INCLUDES);..\..\ole32\tests
+
+C_DEFINES= \
+ $(C_DEFINES) \
+ -DFLAT \
+ -DWIN32=100 \
+ -D_NT1X_=100 \
+ -DUNICODE \
+ -D_UNICODE \
+ -DNOEXCEPTIONS \
+ -DCAIROLE_DOWNLEVEL
+
+BLDCRT= 1
+
+SOURCES= \
+ datausr.cpp \
+ idatausr.rc \
+ perror.cpp \
+ stgmedif.cpp \
+ stpwatch.cpp
+
+
+UMTYPE= windows
+UMENTRY= winmain
+UMAPPL=
+UMTEST=
+UMLIBS=
+UMLIBS= \
+ $(BASEDIR)\public\sdk\lib\*\ole32.lib \
+ $(BASEDIR)\public\sdk\lib\*\comdlg32.lib \
+ $(BASEDIR)\public\sdk\lib\*\gdi32.lib \
+ $(BASEDIR)\public\sdk\lib\*\kernel32.lib \
+ $(BASEDIR)\public\sdk\lib\*\user32.lib \
+ $(BASEDIR)\public\sdk\lib\*\advapi32.lib \
+ $(BASEDIR)\public\sdk\lib\*\crtdll.lib \
+ $(BASEDIR)\public\sdk\lib\*\uuid.lib
diff --git a/private/oleutest/perf16/idata/client/stgmedif.cpp b/private/oleutest/perf16/idata/client/stgmedif.cpp
new file mode 100644
index 000000000..5fb7dca7e
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/stgmedif.cpp
@@ -0,0 +1,60 @@
+#include "datausr.h"
+
+HRESULT
+GetStgMedpUnkForRelease(IUnknown **pp_unk)
+{
+ CStgMedIf *p_smi = new CStgMedIf();
+ HRESULT hr = p_smi->QueryInterface(IID_IUnknown, (PPVOID)pp_unk);
+ return hr;
+}
+
+CStgMedIf::CStgMedIf()
+{
+ m_cRef = 0;
+}
+
+
+STDMETHODIMP
+CStgMedIf::QueryInterface(
+ REFIID riid,
+ LPLPVOID ppv
+)
+{
+ *ppv = NULL;
+ if (IsEqualIID(riid, IID_IUnknown))
+ {
+ *ppv = (LPVOID)this;
+ ((LPUNKNOWN)*ppv)->AddRef();
+ return NOERROR;
+ }
+ return ResultFromScode(E_NOINTERFACE);
+}
+
+
+STDMETHODIMP_(ULONG)
+CStgMedIf::AddRef(void)
+{
+ return ++m_cRef;
+}
+
+
+STDMETHODIMP_(ULONG)
+CStgMedIf::Release(void)
+{
+ ULONG cRefT;
+
+ cRefT = --m_cRef;
+
+ if (0==cRefT)
+ {
+ TCHAR chBuf[80];
+
+ wsprintf(chBuf, TEXT("Reference Count is %d"), cRefT);
+ MessageBox(0,
+ chBuf,
+ TEXT("STGMED pUnkForRelease"),
+ MB_OK);
+ delete this;
+ }
+ return cRefT;
+}
diff --git a/private/oleutest/perf16/idata/client/stpwatch.cpp b/private/oleutest/perf16/idata/client/stpwatch.cpp
new file mode 100644
index 000000000..101e9c190
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/stpwatch.cpp
@@ -0,0 +1,145 @@
+#include "stpwatch.h"
+
+StopWatch_cl::StopWatch_cl()
+{
+ m_Zero();
+}
+
+ULONG StopWatch_cl::sm_TicksPerSecond;
+
+//
+// Init global/static state of the StopWatch class.
+//
+BOOL
+StopWatch_cl::m_ClassInit()
+{
+ LARGE_INTEGER liTPS;
+#ifdef WIN32
+ if(!QueryPerformanceFrequency(&liTPS) )
+ {
+ MessageBox(0,
+ TEXT("Can't read frequency"),
+ TEXT("QueryPerformanceFrequency"),
+ MB_OK);
+ return FALSE;
+ }
+ if (liTPS.HighPart != 0)
+ {
+ MessageBox(0,
+ TEXT("Ticks Per Second is to great"),
+ TEXT("QueryPerformanceFrequency"),
+ MB_OK);
+ return FALSE;
+ }
+ sm_TicksPerSecond = liTPS.LowPart;
+#else
+ sm_TicksPerSecond = 1000;
+#endif
+ return TRUE;
+}
+
+void
+StopWatch_cl::m_Zero()
+{
+ LISet32(m_liStart, 0);
+ LISet32(m_liStop, 0);
+ m_State = ZEROED;
+}
+
+
+BOOL
+StopWatch_cl::m_Start()
+{
+#ifdef WIN32
+ if(!QueryPerformanceCounter(&m_liStart))
+ {
+ MessageBox(0,
+ TEXT("Get Start Time Failure"),
+ TEXT("QueryPerformancecounter Failed"),
+ MB_OK);
+ return FALSE;
+ }
+#else
+ m_liStart.LowPart = GetTickCount();
+ m_liStart.HighPart = 0;
+#endif
+ m_State = RUNNING;
+ return TRUE;
+}
+
+// m_MeasureStop()
+// Returns microseconds per single iteration.
+//
+BOOL
+StopWatch_cl::m_Stop()
+{
+#ifdef WIN32
+ if(!QueryPerformanceCounter(&m_liStop))
+ {
+ MessageBox(0,
+ TEXT("Get Stop Time Failure"),
+ TEXT("QueryPerformancecounter Failed"),
+ MB_OK);
+ return FALSE;
+ }
+#else
+ m_liStop.LowPart = GetTickCount();
+ m_liStop.HighPart = 0;
+#endif
+ m_State = STOPPED;
+ return TRUE;
+}
+
+BOOL
+StopWatch_cl::m_Sleep(UINT msecs)
+{
+#ifdef WIN32
+ Sleep(msecs);
+#else
+ UINT start, elapsed;
+ start = GetTickCount();
+ do
+ {
+ elapsed = GetTickCount() - start;
+ } while ( msecs > elapsed );
+#endif
+ return TRUE;
+}
+
+
+//
+// Return a ULONG count of the number of Microseconds on the timer.
+// I would return LARGE_INTEGER but there doesn't seem to be facilities
+// to user them easily under 16 bit.
+//
+BOOL
+StopWatch_cl::m_Read(ULONG *p_cMicroSeconds)
+{
+ LARGE_INTEGER liTicks;
+
+ int borrow = 0;
+ if(m_liStart.LowPart > m_liStop.LowPart)
+ borrow = 1;
+ liTicks.LowPart = m_liStop.LowPart - m_liStart.LowPart;
+ liTicks.HighPart = m_liStop.HighPart - m_liStart.HighPart - borrow;
+
+ if(0 != liTicks.HighPart)
+ {
+ MessageBox(0,
+ TEXT("Time interval was too great"),
+ TEXT("Failure"),
+ MB_OK);
+ return(FALSE);
+ }
+
+ // result has units of (ticks/ loop of iterations). Where the ticks
+ // are timer specific. This will convert result into:
+ // (Milli_ticks) / (single iteration)
+
+#ifdef WIN32
+ *p_cMicroSeconds = MulDiv(liTicks.LowPart, 1000000, sm_TicksPerSecond);
+#else
+ *p_cMicroSeconds = liTicks.LowPart * 1000;
+#endif
+ return TRUE;
+}
diff --git a/private/oleutest/perf16/idata/client/stpwatch.h b/private/oleutest/perf16/idata/client/stpwatch.h
new file mode 100644
index 000000000..bcfd3faef
--- /dev/null
+++ b/private/oleutest/perf16/idata/client/stpwatch.h
@@ -0,0 +1,28 @@
+#ifndef __STOPWATCH_H
+#define __STOPWATCH_H
+
+#include "../syshead.h"
+#include "../my3216.h"
+
+class StopWatch_cl {
+ private:
+ static ULONG sm_TicksPerSecond;
+ LARGE_INTEGER m_liStart;
+ LARGE_INTEGER m_liStop;
+
+ enum em_STATES { ZEROED, RUNNING, STOPPED };
+ em_STATES m_State;
+
+ public:
+ StopWatch_cl();
+ void m_Zero();
+ BOOL m_ClassInit();
+ BOOL m_Start();
+ BOOL m_Stop();
+ BOOL m_Read(ULONG *);
+ BOOL m_ShowWindow(HWND);
+ BOOL m_Sleep(UINT);
+};
+
+#endif // __STOPWATCH_H
+